Reputation: 346
I am wondering if it would be possible to store evaluated commands in history instead of the alias. Especially with many user having their aliases it is difficult to have an overview of them when searching in history.
Example:
$ alias a2re="apache2ctl restart"
$ a2re
$ history
1 a2re
Instead of:
$ history
1 apache2ctl restart
Does anyone know if there is such an option for bash/zsh?
Upvotes: 2
Views: 546
Reputation: 531125
Not that I am aware of. bash
, at least, records what is in the input buffer (after undergoing history expansion) just prior to hitting Enter to execute the command. One workaround is to tell the shell to expand the line before you commit to executing it. After you type the alias, type Meta-Control-e (where Meta is either your Alt or Esc key, depending on your setup). This will expand the line just like the shell would, but leaves the command on the command line for further editing before executing it by hitting Enter. Then the expanded form of the command is saved in your history.
Upvotes: 2