Solved Read user history at startup /etc/csh.login

Hi, I need to run history 25 during user logging.
Of course, output depends on the specific user logging.
Generally, I've set command alone as I typed but no output at startup.

How can I do that? The following command does not work as I need.

sudo -u my_login csh -c 'history 25'
 
Yes, but I do not see any output. After log in to shell I can run the same command and see history.
 
Right now csh -c 'h' I can see the history but not according to my patern.
I need full date.


user@serv:~ % h
1571 2019-08-09 10:19 sudo visudo
1572 2019-08-09 10:20 sudo visudo
1573 2019-08-09 10:20 man history
1574 2019-08-09 10:21 echo $SHELL

user@serv:~ % csh -c 'h'
1571 10:19 sudo visudo
1572 10:20 sudo visudo
1573 10:20 man history
1574 10:21 echo $SHELL
 
Finally, it works as expected.

/etc/csh.login
csh -c 'set history = ( 1000000 "%h %Y-%W-%D %T %R\n" ) ; history 25'
 
Back
Top