Repeat Command (13 Views)
Reply
Super Advisor
Vincent_5
Posts: 371
Registered: ‎04-02-2000
Message 1 of 5 (13 Views)

Repeat Command

Hi ,
Can someone advice whether can this function be set in C-shell. I have a customer who is using C-shell as their default shell login. And they want to use the feature whereby by pressing a button, you will be able to see the command that key previously, something like when in K-shell, (example you type command swlist, bdf, ioscan -kfnC disk) and by pressing Ecs Key + K on the keyboard will display the previuos command being enter by user. But, can this be done on C-shell. Please help and advice.
nothing is better than to know more
Honored Contributor
Stefan Schulz
Posts: 635
Registered: ‎08-12-1999
Message 2 of 5 (13 Views)

Re: Repeat Command

As far as i know this cant be done in the same way. This functionalety is a result of the built in vi editor. The csh has no built in editor.

You can access the history in csh with the command "history". Of course it is also possible to access the commands in the historylist. E.g.

!! will repeat the las command
!23 will repeat the command numer 23 in the history
!?du will repeat the last command beginning with du .... and so on.

There are also substitiutions and stringreplacements possible. The one i remember is
^this^that This will recall the last command and replace the string "this" with the string "that"

Hope this helps. Stefan
No Mouse found. System halted. Press Mousebutton to continue.
Honored Contributor
Thierry Poels_1
Posts: 1,218
Registered: ‎08-15-2000
Message 3 of 5 (13 Views)

Re: Repeat Command

Hi,
csh does not support command line editing like Korn shell etc.
As Stefan mentioned you can use "!" to recall commands from your history.
If you really want command line editing, you could switch to "tcsh". But I believe that there are also some utilities available: try groups.google.com; you should find some references.
good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Occasional Visitor
Christy K. Greding
Posts: 2
Registered: ‎05-03-2001
Message 4 of 5 (13 Views)

Re: Repeat Command

Hi,
After the person logs on, all they have to type is 'ksh', then they will be in K shell and all commands can be recovered from that point on as the command line is now in VI mode. But I believe if they are trying to run scripts that were meant for C shell, they will have to log out of ksh to do this (they can run a shell within a shell though)...
Good luck.
Honored Contributor
Vincenzo Restuccia
Posts: 1,353
Registered: ‎03-20-2001
Message 5 of 5 (13 Views)
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.