sindresorhus / guides

A collection of succinct guides - Public Domain
2.47k stars 458 forks source link

Aliases aren't expanded in scripts by default. #21

Closed andbroby closed 9 years ago

andbroby commented 9 years ago

See: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

Non-interactive shells don't expand the alias so if you want scripts to use rm -i you'll have to enable it in your BASH_ENV.

sindresorhus commented 9 years ago

Would you mind adding the ZSH counterpart too? http://stackoverflow.com/a/23259088/64949

andbroby commented 9 years ago

Yeah, sure. Even if you use zsh practically all shell scripts will still be executed by bash, so I'll just add a common_profile that's sourced by both BASH_ENV and .zshrc. That way you'll get the alias in bash scripts and in your interactive z shell.

andbroby commented 9 years ago

Whew. That should cover it.

sindresorhus commented 9 years ago

Oh, wow, didn't know it were that complicated on ZSH. Thank you! :)