I know I once know how to do this but... how do you run a script (bash is OK) on login in unix?
Join Stack Overflow to learn, share knowledge, and build your career.
|
|
From wikipedia Bash
|
||||
|
|
|
I was frustrated with this problem for days. Nothing worked on ubuntu. If I put the call in /etc/profile it all crashed at login attempt. I couldn't use "Startup Applications" as that was not what I wanted. That only sets the script for that current user. Finally I found this little article: http://standards.freedesktop.org/autostart-spec/autostart-spec-0.5.html The solution would be:
|
|||
|
|
|
If you want it to run on your login put it in Start
Stop item
Example
|
||||
|
|
|
The script |
||||
|
|
|
Place it in your bash profile:
|
||||
|
|
|
If you are on OSX, then it's |
|||||||||
|
|
Search your local system's bash man page for ^INVOCATION for information on which file is going to be read at startup.
Also in the FILES section,
Add your script to the proper file. Make sure the script is in the $PATH, or use the absolute path to the script file. |
|||
|
|
|
At login, most shells execute a login script, which you can use to execute your custom script. The login script the shell executes depends, of course, upon the shell:
You can probably find out what shell you're using by doing
from the prompt. |
|||||
|
|
Add an entry in |
||||
|
|
|
If you wish to run one script and only one script, you can make it that users default shell.
can have interesting effects :) ( its not secure tho, so don't trust it too much. nothing like setting your default shell to be a script that wipes your drive. ... although, .. I can imagine a scenario where that could be amazingly useful ) |
|||
|
|
|
When using Bash, the first of I typically put everything I want to always set in |
|||
|
|