2
votes
1answer
142 views

Get the last executed command line in ksh

Is there a way to get the last executed command possibly together with the arguments within a ksh script? I am using mksh with cygwin. I tried fc -nl -1, but the script throws a "“fc: history ...
-2
votes
2answers
908 views

History command in ksh not able to use [closed]

I am using the ksh shell. I am not getting any impact of these following commands. It is executing without any error but it is not giving the proper results. export HISTTIMEFORMAT='%F %T ' Use the ...
1
vote
2answers
1k views

Shell - Deal with multiple command history files

Where I work, for security and auditing purpose, we have to keep one history file for each session (user, date, terminal, etc in the file name). Obviously, the HISTFILE variable, is set to read only ...
5
votes
6answers
645 views

Last command in ksh

In bash I can use !! to indicate the last command. In ksh I think you can use r to do something similar, but it seems to fail in one of my common patterns: typing sudo [last command]. > cp foo ...
5
votes
4answers
2k views

How to have separate command history for different sessions for the same user?

I face this issue on some of Unix servers. When I open different session for same user, command history is shared by all the session. This creates issues if by mistake I press Ctrl-P or up arrow and ...