Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-18-2007, 01:13 AM   #1
Registered: Jan 2007
Posts: 39

Rep: Reputation: 15
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??
Old 01-18-2007, 01:24 AM   #2
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
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.
Old 01-18-2007, 01:46 AM   #3
Registered: Mar 2004
Location: Austin, TX
Distribution: CentOS Fedora RHEL SLES Knoppix
Posts: 78

Rep: Reputation: 15
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...

Old 01-18-2007, 01:55 AM   #4
Registered: Jan 2007
Posts: 39

Original Poster
Rep: Reputation: 15
Thank you very very much!!!!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SL-NV400-64 Boot Menu Shorcut routers Linux - Hardware 0 10-18-2005 11:26 AM
Creating shorcut icon on destop Rose_love Linux - Games 2 10-05-2005 10:12 PM
How can I create KDE/Gnome menu shorcut via perl script? mf1234 Programming 1 08-16-2005 05:46 PM
Keyboard Shorcut for Terminal?? spacemonk Red Hat 0 07-30-2004 04:03 AM
kde shorcut to minimise all windows archu Linux - Newbie 5 05-29-2004 09:28 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration