User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 391,564 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,615 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 561 | Replies: 3 | Solved
Reply
Join Date: Nov 2007
Posts: 104
Reputation: k2k is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
k2k k2k is offline Offline
Junior Poster

how do i run the shell script?

  #1  
May 20th, 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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,257
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 20
Solved Threads: 368
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: how do i run the shell script?

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

./shellProgramming To run it.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Join Date: Feb 2008
Location: India
Posts: 5
Reputation: iceman29 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
iceman29's Avatar
iceman29 iceman29 is offline Offline
Newbie Poster

Re: how do i run the shell script?

  #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  
Join Date: Oct 2007
Posts: 256
Reputation: eggi is on a distinguished road 
Rep Power: 1
Solved Threads: 26
eggi eggi is online now Online
Posting Whiz in Training

Re: how do i run the shell script?

  #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!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Shell Scripting Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 10:06 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC