Saturday, April 14, 2007

Repeat the Previous UNIX Command

Here's a handy command to know, especially when the command line syntax is long. I've included an example for both c and ksh shell.

For C shell
#csh
#vi this_is_a_very_long_filename
text
:wq! (saves and quits vi)

Repeats the command
#!!

For ksh shell
#ksh
#vi this_is_a_very_long_filename
text
:wq! (saves and quits vi)

Repeats the command (r is a built-in alias fc -e -)
#r

No comments: