String substitution using the r alias
You can use the r Korn shell alias to modify a command before it is run.
In this case, a substitution parameter of the form Old=new can be used to modify the command before it is run.
The following examples show how to use the r alias:
- If command line 940 is ls *.txt,
and you want to run ls *.exe, at the
prompt, type the following:
r txt=exe 940
This runs command 940, substituting
exe
fortxt
. - If the command on line 940 is the most recent command that starts with
a lowercase letter l, you can also type the following:
r txt=exe l
Note: Only the first occurrence of the Old string
is replaced by the New string. Entering
the r Korn shell alias without a specific command number or character
performs the substitution on the immediately previous command entered.