Shorcut to sh file
Hi all
I want to create a file for example with name run And want to login to linux as root and type run and want this script do somethings.. Where I must put it?? Thanks... |
Login as root and look for content of PATH variable (with echo $PATH). You'll see all the directories where shell will look for commands. Put your script in one of them.
|
When logged in as root your home should be /root
To verify it; "echo $HOME". Irregardless of the user that you are logged in as, a directory called bin should exist in $HOME, if it doesn't create it and put your executable in there... By default $HOME/bin is part of the directory path. To verify it; "echo $PATH" Then, make sure the script is set to executable. To verify it; "ls -al <scriptname>" You should see something like: -rwxr--r-- 1 root root 27 Jan 01 01:01 <scriptname> If the executable bit is not set, use "chmod" to set it. Now, regardless of what directory you are in while you are logged in as root, you can just execute the script by typing in the scriptname. NOTE: Disregard the previous posters recommendation to put it in any directory in the path, that is just plain wrong... /Les |
Thank you very very much!!!!
|
All times are GMT -5. The time now is 12:37 AM. |