how do i run the shell script?

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Nov 2007
Posts: 227
Reputation: k2k is an unknown quantity at this point 
Solved Threads: 0
k2k k2k is offline Offline
Posting Whiz in Training

how do i run the shell script?

 
0
  #1
May 21st, 2008
i used vi:
%vi shellProgramming

and then i typed the shell script in the vi and saved with :wq

However, when i run the vi file ...... %shellProgramming

my unix says "command not found"

why is that? and how do i run the vi shell scripting file? thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: how do i run the shell script?

 
0
  #2
May 21st, 2008
chmod u+x shellProgramming To make it executable

./shellProgramming To run it.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 12
Reputation: iceman29 is an unknown quantity at this point 
Solved Threads: 2
iceman29's Avatar
iceman29 iceman29 is offline Offline
Newbie Poster

Re: how do i run the shell script?

 
0
  #3
May 21st, 2008
can also name the file as shellProgramming.sh and diretly run it by giving it as

sh shellProgramming.sh

on the prompt.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: how do i run the shell script?

 
0
  #4
May 21st, 2008
Hey there,

You can also place it in a directory in your PATH, after you make it executable, so you can run it from anywhere.

I dont' recommend adding a dot to your PATH, but just do

echo $PATH

and copy your script into one of those directories and you can just run it by calling its name wherever you are on the filesystem

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum


Views: 1381 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Shell Scripting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC