Suppose you have executed the following series of scripts(commands) for an argument say 12.34.
$ ./vali.sh 12.34 && ./sub.py 12.34 && rm /tmp/12.34.lck
Now if you need to repeat the same command, but this time for argument 11.3, then you can always go to command history (basically last command using your arrow keys), edit the 12.34 to 11.3 and you are done.
But, sometime if you don't want to take the risk of making any typo, you can change the argument in all the places using this:
$ !!:gs/12.34/11.3/
Which is basically:
./vali.sh 11.3 && ./sub.py 11.3 && rm /tmp/11.3.lck
Related posts:
- Accessing last argument of previous command
- Recall last argument of last command in bash
No comments:
Post a Comment