Rorschach Rorschach - 1 year ago 71
Bash Question

Execute command if su to a certain user

If I enter

sudo su - Rorschach
and login as Rorscach. I would like a command to be executed automatically.

Such as
echo "Hello Rorschach"
cd ~

Where do I put these scripts in order for them to be performed upon login of that user?

I am using an ubuntu 14.04 command line and
echo $0

Answer Source

~/.bash_profile (recommended) or ~/.bashrc (will work, but this file should rather contain functions and aliases, not commands).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download