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

Re: script/history



On Sun 04/02/2024 at 17:33, Greg Wooledge <greg@wooledge.org> wrote:
...
> The script(1) utility has NOTHING to do with running ordinary shell
> scripts.

I understand that.

I was trying to view the history of commands run during a script session.

user@qwerty:~$ script foo
Script started, output log file is 'foo'.
user@qwerty:~$ date
Mon  5 Feb 00:21:16 GMT 2024
user@qwerty:~$ exit
exit
Script done.
user@qwerty:~$ history |tail -n3
30914  2024-02-04 23:44:24  man script
30915  2024-02-05 00:21:15  script foo
30916  2024-02-05 00:21:25  history |tail -n3 # NB "date" is missing

Michael Grant pointed out (among other things) that the history is available, but not in the terminal in which script has just exited.

Meanwhile, I read man script and wondered if csh, or even just csh's approach to history manipulation, was somehow involved.

I was then a little surprised to see 

user@qwerty:~$ csh             # bash prompt
% script foo                   # csh prompt
Script started, output log file is 'foo'.
user@qwerty:~$ date            # bash prompt in script in csh in bash
Sun  4 Feb 23:25:14 GMT 2024
user@qwerty:~$ exit
exit
Script done.
% exit
% exit
user@qwerty:~$ 

although on a "native" csh system, I would expect script to "present" csh, not bash.  I 

I am left with the impression that script may impose csh's history substitution/manipulation approach/syntax (for what differences there may be) regardless of which shell it's running from, and that that is the reason for the reference to csh for the "history mechanism" in man script.

Thanks
Gareth


Reply to: