LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-05-2005, 01:31 AM   #1
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Rep: Reputation: 15
How to run the script ?


i have a perl script in myfolder .

directory structure is
/root/myfolder

when i stay at "myfolder " directory i run by "./my_script"
[....@myfolder]#./myscript ===>it works .

Now, i am at the "root" folder i.e one levl up directory . how do i run the script from the "root" directory Now?

[....@root] how do i run the script now ?
 
Old 10-05-2005, 01:43 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
myfolder/myscript

You could also do,
cd myfolder; ./myscript
on one line.

Of course, if the script doesn't do something such as install software on the system, perhaps you shouldn't be running it as root.
 
Old 10-05-2005, 10:56 AM   #3
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
to add to that and make it as clear as possible... if you are running a script in the current directory, you use "./<name>".

If you are not in the same directory as the script, just enter the name of the script.. without "./"

Example:
Code:
$ pwd
/home/halo14
$ ./script1
<script runs>
$ cd /
$ pwd
/
$ /home/halo14/script1
<script runs>
I hope that was relatively undertstandable?
 
  


Reply


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
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 06:49 AM
Script to run script in multiple directories... seabass55 Linux - General 5 07-06-2004 12:44 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM
can't run a script script from icon in konqueror scottsteibel Linux - Software 1 08-02-2003 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:13 PM.

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