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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: