I am trying to write bash shell script in Ubuntu 11.10 Linux distro, that will get executed automatically on logging into the system. But I am not able to figure out that what to write in script that by it will get automatically executed on logging in.
If you want it to be global, modify
or add a script to
If you want it to be user-specific, modify
Just add the bash script to the Startup applications.
In the command field, enter
If you want to be more bash specific you can also write you code in ~/.bash_profile or ~/.bash_login.
And you can source any script therein for example:
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
I would highly recommend against using
/etc/profile.d/yourscript.sh if it produces output. When you use a non-interactive session, you will receive a
$TERM is not set message. This is noticeable when using the ssh protocol, like scp. Usually not a big deal, however, Veeam doesn't like it and will throw a warning. I know Veeam is not the topic here, but it's worth mentioning that not all applications will gracefully ignore the
$TERM is not set warning.
In short, if the script generates output, place it in the locations specified on the first line. However, if you're modifying the environment and your script doesn't generate output, then use the latter.