LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 01-01-2004, 06:12 PM   #1
unimaginative
Member
 
Registered: Aug 2003
Location: USA
Distribution: SuSE 8.2 Professional
Posts: 159

Rep: Reputation: 30
how do i create a script


i want to create a script that does the following
"cd /opt/fire
./MozillaFirebird"
when i type firebird. how is this done
 
Old 01-01-2004, 06:19 PM   #2
benjithegreat98
Senior Member
 
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019

Rep: Reputation: 45
Create a file called firebird and type the script commands you want executed.
"vi firebird" or your favorite editor...

after you save it you need to make the file executable
"chmod +x firebird"

now move firebird to somewhere that is in your path, such as /bin so it can be executed anywhere
"mv /home/you/firebird /bin"

now type firebird, sit back and bask in your own glory.
 
Old 01-01-2004, 06:21 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
I'm not sure why you would want to write a script to do this for you when you can just add /opt/fire in your users path by adding it to their .bashrc, .bash_profile or /etc/profile files.
Or you can just create a symlink in /usr/bin to the executable:

cd /usr/bin
ln -s /opt/fire/MozillaFirebird firebird

But if you insist, do this in the script you create:

Code:
#!/bin/bash
#
cd /opt/fire
./MozillaFirebird
chmod +x <script-name>

Last edited by trickykid; 01-01-2004 at 06:22 PM.
 
Old 01-01-2004, 06:25 PM   #4
poison
Member
 
Registered: Dec 2003
Location: Layer 7 =D
Distribution: Slackware, LFS, Rock Linux
Posts: 165

Rep: Reputation: 30
create a new file named firebird in /usr/local/bin with your editor of choice...
the very first thing in this file is the shebang line....it tells your shell which interpreter to use...remember it must be at the very beginning of the file
Code:
#!/bin/bash
then...just insert what you've already posted
Code:
/opt/fire/MozillaFirebird
then make it executable by typing
chmod a+x /usr/local/bin/firebird
easy, ain't it ? ^^
happy new year (my head still is aching =P)

Last edited by poison; 01-01-2004 at 06:26 PM.
 
Old 01-01-2004, 06:36 PM   #5
unimaginative
Member
 
Registered: Aug 2003
Location: USA
Distribution: SuSE 8.2 Professional
Posts: 159

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by trickykid
I'm not sure why you would want to write a script to do this for you when you can just add /opt/fire in your users path by adding it to their .bashrc, .bash_profile or /etc/profile files.
Or you can just create a symlink in /usr/bin to the executable:

cd /usr/bin
ln -s /opt/fire/MozillaFirebird firebird

But if you insist, do this in the script you create:

Code:
#!/bin/bash
#
cd /opt/fire
./MozillaFirebird
chmod +x <script-name>
trickykid, the reason why i didn't add /opt/fire to my user path is because i have no idea what a userpath is!
 
Old 01-01-2004, 06:51 PM   #6
poison
Member
 
Registered: Dec 2003
Location: Layer 7 =D
Distribution: Slackware, LFS, Rock Linux
Posts: 165

Rep: Reputation: 30
the path is a envoironment variable that points to the directorys on your system which contain executables...
type:
echo $PATH
to see what I mean ^^
but creating that one script is ok...
you dont need to change the path since the script in /usr/local/bin will be in yout path, thus accesseble...
 
Old 01-01-2004, 06:53 PM   #7
unimaginative
Member
 
Registered: Aug 2003
Location: USA
Distribution: SuSE 8.2 Professional
Posts: 159

Original Poster
Rep: Reputation: 30
thanks

thanks to everyone who brightened my day
thanks to jeremy for hosting a messageboard where you can get your questions answered in five seconds or less
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a login script? jedimastermopar *BSD 4 08-02-2004 08:07 AM
create users using script polis Linux - General 1 05-18-2004 08:19 AM
How do I create a script in SUSE 8.2? byfaithalone Linux - Newbie 2 10-16-2003 11:32 AM
How to create many by a script kelper Linux - General 11 09-24-2003 03:09 PM
How do I create a script? ACURA TL-S Linux - Newbie 1 08-03-2003 09:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:46 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