LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 05-24-2004, 08:00 AM   #1
toejam
LQ Newbie
 
Registered: Apr 2004
Distribution: WBLE r3.0
Posts: 22

Rep: Reputation: 15
how do you run scripts




Folks, making the switch from Win2k Server to WBEL. General newbie question. How do you run script files. I have several .bat files that I run on my Win2k Server, I'd like to be able to do the same thing in Linux, I'm sure this is possible I just don't know how to do it yet. Go easy on me, as I said, I'm new to Linux.

Thanks.
 
Old 05-24-2004, 08:14 AM   #2
Nis
Member
 
Registered: Jul 2003
Location: Virginia
Distribution: Ubuntu Hoary (5.04)
Posts: 550

Rep: Reputation: 30
No batch files here. You'll have to convert them to shell scripts; check out Advanced Bash-Scripting Guide for some great help with that. Then to run them, cd to script directory and
Code:
./script-name
or
Code:
sh script-name
Try one and if that doesn't work, try the other. I can never remember the rules about that.
 
Old 05-24-2004, 08:15 AM   #3
kevinatkins
Member
 
Registered: Jan 2004
Location: cheshire, uk
Distribution: Ubuntu Hoary
Posts: 605

Rep: Reputation: 31
to run a script file, first make sure that the 'executable' bit is set in the file properties (it won't be by default, for instance if you use a text editor to create the file). this can be accomplished either at the command line - eg chmod +x filename, or using konqueror - right-click on the file and select 'properties'.

then, to actually run the file, you can either click / double-click on it from a gui, or from the command-line, prepend ./ to the beginning of the filename - eg, using the example above, you'd type ./filename then hit return.

the ./ tells the shell to use the current working directory, which isn't necessarily in the environment $PATH variable.
 
Old 05-24-2004, 08:18 AM   #4
toejam
LQ Newbie
 
Registered: Apr 2004
Distribution: WBLE r3.0
Posts: 22

Original Poster
Rep: Reputation: 15
found my answer:
- first I created my script file
- then I did a chmod +x on the file to make it executable
- then I moved it to the /bin dir
- open a new terminal window
- typed the name of my file and it runs my script

I would guess that there are other way to accomplish this since *nix is Script friendly, if you have other to suggest please let me know.

Thanks!
 
Old 05-24-2004, 08:20 AM   #5
toejam
LQ Newbie
 
Registered: Apr 2004
Distribution: WBLE r3.0
Posts: 22

Original Poster
Rep: Reputation: 15
Thanks kevinatkins.

We must have been typing at the same time...
 
Old 05-24-2004, 08:24 AM   #6
toejam
LQ Newbie
 
Registered: Apr 2004
Distribution: WBLE r3.0
Posts: 22

Original Poster
Rep: Reputation: 15
DUH!

Ty too Nis

That did the trick as well.

Enjoying Linux

 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
new scripts won't run new2me Linux - Newbie 4 06-09-2005 09:14 AM
How to? Run Shell scripts jmr0311 Mandriva 2 07-14-2004 09:24 PM
How to run .sh scripts piggysmile Linux - Software 2 06-24-2004 06:18 AM
How do i get scripts to run? jihadcman Fedora 3 06-06-2004 10:15 AM
cannot run scripts unless su odious1 Linux - General 5 07-19-2003 12:25 AM


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

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration