Archive | February, 2012

remote bash gotcha: aliases

9 Feb

I found the following useful in simulating a login.

Specifically, the -l will cause /etc/profile to be read.

But the real gotcha was, why aren’t those aliases in /etc/profile
being evaluated? The answer was the -i flag; bash by default doesn’t
expand aliases on a non-interactive shell!

Also, set -e is very recommended. Stops the script if something breaks.

ssh user@host ‘bash -i -l -s’ set -e

END

Advertisements