When your .zshrc
is loaded, the alias
command is evaluated. The command consists of two words: a command name (the builtin alias
), and one argument, which is the result of expanding cleanup="rm -Rf `pwd`/{foo,bar,baz}"
. Since backquotes are interpolated between double quotes, this argument expands to cleanup=rm -Rf /home/unpluggd/{foo,bar,baz}
(that's a single shell word) where /home/unpluggd
is the current directory at that time.
If you want to avoid interpolation at the time the command is defined, use single quotes instead. This is almost always what you want for aliases.
alias cleanup='rm -Rf `pwd`/{foo,bar,baz}'
However this is needlessly complicated. You don't need `pwd/`
in front of file names! Just write
alias cleanup='rm -Rf -- {foo,bar,baz}'
(the --
is needed if foo
might begin with a -
, to avoid its being parsed as an option to rm
), which can be simplified since the braces are no longer needed:
alias cleanup='rm -Rf -- foo bar baz'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…