Linux – Start script on logon

bashlinuxscriptunix

I understand shell executes commands in either ~/.bash_profile, ~/.bash_login or ~/.profile, whichever is found first.
My system has only .profile, yet commands entered there won't get executed on startup/login.

The script I'm talking about is essentially a cron front-end/TO-DO list manager. When user logs in (as in user gets access to his personal files/logs in to his account), the script should execute, checking whether there are any tasks that have failed to remind. If it finds any, zenity prompt will be poped up, asking next input.

Best Answer

First create your ~/.bash_login and make it do something simply (like echo a phrase.)

echo "echo Look at me go" > ~/.bash_login

Then use bash -l like @mata said. The -l flag will run the bash as if it were the login shell (to make sure it reads your settings files.)

Related Question