Click to See Complete Forum and Search --> : execute command on login
Sawdusty
06-09-2002, 01:22 PM
Hello,
I'd like to be able to have a set up so that a command can be executed at login for certain users. I've tried putting it in ~/.bash_profile, but that wouldn't run it... is there some sort of bash_init or something that I can put a command in to be run on every login for specific users?
I'm using the text console with agetty, not xdm or it's descendants.
Thanks,
Dusty
Sawdusty
06-10-2002, 01:45 PM
^bump
I didn't think it was a hard question, but I can't find anything on it on google.
Dusty
z0mbix
06-10-2002, 01:46 PM
~/.bashrc ?
Sawdusty
06-10-2002, 06:04 PM
that's not the same as .bash_profile? I'll give it a try. Thanks. :)
Dusty
Strogian
06-10-2002, 06:15 PM
Normally, ~/.bash_profile should be run at startup. The only time it wouldn't, AFAIK, is when you're using 'su' to log in, instead of actually logging in from the prompt. (then it will run ~/.bashrc instead) Or, if you are passing the --noprofile option to bash for some reason, but I don't quite know how logging in is handled yet, so I wouldn't know how to check for that.
Sawdusty
06-10-2002, 08:44 PM
I got it working with .bash_profile now... you were right -- I was testing it with su before.
Dusty
bwkaz
06-11-2002, 01:00 PM
Something useful that I do in my .bashrc is this:
[ -f ~/.bash_profile ] && . ~/.bash_profile
That way, if there is a .bash_profile in your home directory, it will get run whenever .bashrc is run.
Whipping Boy
06-11-2002, 01:05 PM
su -l WILL run your bash_profile, however.