I have ran certain commands in korn shell script as follows:
324 pwd
325 list
326 cd mpiomp
327 list
328 cd C
329 list
330 history
How can I retrieve the pwd
command by using r
? Currently I am using r -324
but its not working.
The documentation of the r
commands shows that you are using it wrong. here are the relevant parts:
The r command (a built-in KornShell alias) re-executes a command you ran previously, possibly editing it first. Commands are obtained from your command history file.
The specifier tells which command you want to re-execute. It can have any of the following forms:
An unsigned number ( n )
Run the command with that number.A negative number ( -n )
Runs the command that came n commands before the current one.
As you can see, calling the command r 324
will execute the command with that history number.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.