bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possible bash bug - 'history'


From: Mike Fied
Subject: possible bash bug - 'history'
Date: Fri, 19 Jul 2013 11:23:46 -0400

Dear GNU developer/code maintainer,

Please take a second to take a look at this problem - this might or might
not be a bug, or rather a feature is not implemented in BASH:
I am trying to get the current or "last" command line printed as the result
of history, or a BASH variable ( to my knowledge it does not exist )

# echo "blah_blah" ; echo "$THIS_CMD_LINE" ( or history -n0 )


I can do this in ksh:
# hist -l -n0
( will output the same, in this case "hist -l -n0" )

and C-shell:
# ls > /dev/null ; history 1
( will display right that command line executed )


The reason I want to get the current command in stdout is a small sh that I
have, that texts me the last command, and exit code via text... I do not
want to invoke the command with:

# smsme [ long_process ]
rather
# [ long_process ] ; smsme

in both ksh and csh works fine....
also, in order to get this to work, I had to enable 'bashlogger' flag and
recompile BASH, and tail the last line from /var/log/bash.log... it works (
workaround ), but bashlogger needs to be enabled....


Why I consider this as a bug? POSIX compatibility - this behavior is
available in 'ksh'
plus also in 'csh' ( which is a different story and probably does not apply
here )


system/version details:

GNU bash, version 4.2.10(2)-release (x86_64-pc-linux-gnu)
compile flags used:
bashlogger, net, nls

Gentoo x86_64
E3-1245v2

fix? none ( workaround )


Thank you and have a good weekend,

Mike FIedler


reply via email to

[Prev in Thread] Current Thread [Next in Thread]