Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a command from history in korn shell 3

Status
Not open for further replies.

ddrillich

Technical User
Jun 11, 2003
546
US
Good Day,

I have the following history:

$ history
190 cd inst-QACMS
191 pwd
192 ls -lt
193 cd logs
194 ls
195 ls -lt
196 cd cms
197 ls -lt
198 tail -100 bob.log
199 ls -lt
200 cat vhs-cds-info-3436.tmp
201 ls -lt
202 tail -100 bob.log
203 pwd
204 ls -lt | more
205 history


I would like to run the 200 command. How can I do that?

Thanks,
Dan
 
esc-k then type cds then enter key. This will bring up the last command that contained cds. press n to go to the next command that contains cds.
 
See the man history pages, before trying:
fc -s 200

I hope that helps.

Mike
 
Hi Mike,

fc –s 200 worked!

I have no idea how to run kHz's command.
kHz, what do you mean by esc-k?

Thanks,
Dan
 
press the escape key followed by the 'k' key. Then type a '/' then whatever partial command you are looking for.

Less time than typing history followed by fc -s <number>, if you know what you are looking for.
 
Not much luck ;-)

$ ^[k/pw
ksh: ^[k/pw: not found

-- Dan
 
Also with ksh, when you have recalled your command you can edit it by pressing the 'v' key.

Using your original question:
press esc-k-/ <type cds> then press enter

This will bring up
# cat vhs-cds-info-3436.tmp

and if you need to edit this line and change 3436 to 3536, for example, you can bring the command line up with vi.

just type 'v'
 
Thanks a lot sibisuresh!

I guess r stands for repeat. However, "man r" and "which r" don't bring a thing. So, what is it ;-) ?

Thanks,
Dan
 
Could stand for recall too, but perhaps that's enough conjecture as long as it works!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top