Launch Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Launch Script
# 1  
Old 09-23-2009
Launch Script

Hi all! I just got done writing a script. The problem Im running into is I have to lanuch the script with:

Code:
sh SCRIPT.sh

Is there a way to launch it with by just entering

Code:
SCIPT

into the shell?
# 2  
Old 09-23-2009
if you make the script executable you can launch it from it's own directory like this:

./SCRIPT.sh

if you put its directory in your PATH, you can launch it from anywhere like this:

SCRIPT.sh

If you want to launch it like this:

SCRIPT

you have to rename it (and it's directory has to be in the PATH):

mv SCRIPT.sh SCRIPT
# 3  
Old 09-24-2009
And it is best to put a shebang on the first line of your script e.g.
Code:
#!/bin/sh

or e.g.
Code:
#!/bin/ksh

Then the script will always be run with that particular shell, no matter what parent shell it was called from...
# 4  
Old 09-24-2009
Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Launch shell script with parameters from a webpage button

I want to create a simple html page that should contain 2 fields in which the user can write the input. Then I want to have a button that should launch a shell script with the parameters inserted by user in the fields from the webpage. This is the code behind my webpage: <html> <form... (2 Replies)
Discussion started by: black_fender
2 Replies

2. UNIX for Dummies Questions & Answers

Launch shell script if string match is found

I'm trying to write a simple shell script that looks at a given text file and if the only word in the file is 'completed', it launches another shell script. So far I have this almost working... if grep 'completed' $datafile then... however, using this logic the secondary shell script... (3 Replies)
Discussion started by: MickeyGreen
3 Replies

3. Shell Programming and Scripting

Perl script timer on program launch

So I am attempting to get a short but complex perl script to be able to time out an application that I will launch from a command line. The terminal I use is MKS C SHELL and I am having trouble doing the a job spawn that will launch the application and keep time on it. I know you could do this... (1 Reply)
Discussion started by: vas28r13
1 Replies

4. Shell Programming and Scripting

Launch a windows program from perl script

Hi i wanted to know if any one can give me an example on how to launch a windows program in a perl script. I wanted to open the nmap software on my computer with a perl script, i heard this can be done with the system function. Would the function be in this format: $text =... (1 Reply)
Discussion started by: kingbp
1 Replies

5. Shell Programming and Scripting

Shell Script to launch C program

Hi there, im new too shell scripting and was wondering if it is possible to create a shell script to take in a variable and load a c program. My C program is a file monitor, and is started by using the terminal and using to following code ./monitor FileToBeMonitored is it possible to have... (12 Replies)
Discussion started by: gazmcc182
12 Replies

6. UNIX for Dummies Questions & Answers

How to launch a script from the emacs minibuffer?

Hello! I' m editing a script (script.sh) with emacs, and I would like to launch it from the minibuffer. Is it possible? If I do M-X and then ./script.sh i get the message "no match" ...:confused: (0 Replies)
Discussion started by: vero_81
0 Replies

7. Shell Programming and Scripting

launch vnc session from unix shell script

Hi All, OS:AIX 64 bits Would like to know what is the command to launch vnc session from unix shell script so that Reports server is started from vnc session which should be launched from within the shell script. Thanks for your time! Regards, (0 Replies)
Discussion started by: a1_win
0 Replies

8. UNIX for Dummies Questions & Answers

Creation of a script to launch several programs

I'm really new to this, so thanks for your patience... I've been trying to create a script to launch several applications at once. I've been researching books and forums, but I end up with more questions than answers. As much as I hate to say it, I don't know if I can figure it out on my own...... (3 Replies)
Discussion started by: j.middlefinger
3 Replies

9. UNIX for Advanced & Expert Users

Can we launch a shell script automatically upon ssh login?

Greetings all, I'll just like to know if it is possible to launch a shell script automatically upon a user's successful login into ssh from a remote host, without adding a command parameter to the ssh command... ie. after keying in ssh username@host (not ssh username@host "command") and upon... (1 Reply)
Discussion started by: rockysfr
1 Replies

10. Solaris

Script to launch terminal window?

Hi, I am a newbie here. Trying to find a way of writing a script to launch multiple terminal or console windows on solaris 9. I used to be able to do this using cmdtool on older versions of solaris and it was even possible to configure the size and screen position of the window and the title. ... (5 Replies)
Discussion started by: omerta
5 Replies
Login or Register to Ask a Question