How to create unix alias with command substitution

2020-05-07 02:53发布

问题:

I would like to create an alias for the following. Would you please let me know how to set this up?

mate  \`find . -name <filename>\`

回答1:

use a function instead: mymate() { mate $(find . -name "$1"); }



回答2:

This is an indirect solution. Put the command in a file (whithout .sh say cmdfile) under ~/bin then give the alias as alias myalias=cmdfile



标签: shell unix