LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 05-09-2006, 09:20 PM   #1
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Rep: Reputation: 15
scripts? how


ok even with a wierd keyboard glitch that seems unsolvable i find my self doing a lot of typing
one examble is hamachi
cd network
cd tools
hamachi start
hamachi login
hamachi go-online NETWORKNAME

then to start up the bf1942 server its
cd ..
cd ..
cd bf1942
bfsmd -restart -start -priority 1 -daemon +statusmonitor 1 (though the + bit doent work as thiers no screen to put it in if i remove daemon it works but i cant logout)

its annoying typing all that in everytime i tried putting it in a txt file removing the txt bit and calling it bfscript but what do i type to make it work?
bfscript says bash file not found (ok words to that affect) i even tried chmod +x bfscript as root but no go

im stuck ...again
 
Old 05-09-2006, 09:40 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
OK. It seems that your shell is bash.

To write a bash script to do all that, use a text editor to create a script (for the sake of argument, let's call it bfscript.sh).

The first line of the script MUST be #!/bin/bash (the provervial she-bang line).
Then, just type in the commands as you have listed them (one command per line).

For the sake of completeness, include the last line 'exit 0'. Within bash, you can query an app to see if it executed properly. If the exit return is 0, it ran successfully. Any other return means it ended with an error.

For more on writing bash scripts, see:
Bash Guide for Beginners
Advanced Bash-Scripting Guide

PS. If you alrady have a bfscript.sh somewhere, and if that location is not in the user's or root's path, you wil get the "comand not found" error. You must specify the full path to the location of that script, or cd to that subdirectory, then issue the command thusly: ./bfscript.sh. The leading ./ tells bash that the script is located in this directory (if you use the full path, the leading ./ is not necessary).

Last edited by bigrigdriver; 05-09-2006 at 09:45 PM.
 
  


Reply



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
VPN: Debian Scripts -> Mandriva 2006 Scripts Undefined Mandriva 0 11-30-2005 12:10 PM
Need help running scripts from scripts sdouble Linux - Newbie 3 05-31-2004 12:56 PM
scripts??? andym Linux - Newbie 2 04-28-2003 06:02 AM
What scripts? whaase Linux - Newbie 6 11-14-2002 10:42 PM
Scripts leriche_job Linux - Software 4 04-16-2002 04:30 PM

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

All times are GMT -5. The time now is 03:35 AM.

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