Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

Repeat Command

Vincent_5
Super Advisor

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
4 REPLIES
Stefan Schulz
Honored Contributor

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.
Thierry Poels_1
Honored Contributor

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.
Christy K. Greding
Occasional Visitor

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.
Vincenzo Restuccia
Honored Contributor