Hack 61. Substitute words from history commands
by Ramesh
When you are searching through history, you may want to execute a different command but use the same parameter from the command that you’ve just searched.In the example below, the !!:$ next to the vi command gets the argument from the previous command to the current command.
- # ls anaconda-ks.cfg
- anaconda-ks.cfg
- # vi !!:$
- vi anaconda-ks.cfg
In the example below, the !^ next to the vi command gets the first argument from the previous command (i.e cp command) to the current command (i.e vi command).
- # cp anaconda-ks.cfg anaconda-ks.cfg.bak
- anaconda-ks.cfg
- # vi !^
- vi anaconda-ks.cfg
当前内容版权归 Ramesh Natarajan 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Ramesh Natarajan .