The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 11:31 AM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 12:06 AM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 07:15 AM
returning to the parent shell after invoking a script within a script gurukottur Shell Programming and Scripting 5 09-26-2006 04:05 AM
return valuse from child script to parent script borncrazy Shell Programming and Scripting 1 08-20-2004 12:39 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-03-2007
Registered User
 

Join Date: Oct 2007
Posts: 9
Using a script?

I have never use a shell script.. I would like to use this one...
Copying files between 2 Unix server

How do I set this up? Thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-03-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
A script is simply a list of instructions that you may type at the keyboard, but put in a file with a very simple header ( "#!/bin/sh" ). They are then made executable using "chmod +x script-name".

These are normally stored in a well choosen directory and are run by type their pathname at the shell prompt. They can also be executed by other agents such as cron, or at startup/shutdown.

A commonly used naming convention is they have the shell type as an extension, eg *.sh, *.ksh, *.csh etc.
Reply With Quote
  #3 (permalink)  
Old 10-03-2007
Registered User
 

Join Date: Oct 2007
Posts: 9
Hmm.. So I should copy and paste the code from the thread above into a text editor... Upload that file to /bin.. then call that file?
Reply With Quote
  #4 (permalink)  
Old 10-03-2007
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
There is no need to put the script on the bin directory.

- copy the text into a text file adding in the first line #!/bin/sh (or whatever your shell is)
- chmod +x filename.sh ( makes the text file executable
- then you can add the directory where the file is located to the user path, if you want.
- if you saved the file on /root then you can run it with:
/root/filename.sh <--- press enter

- voilá
Reply With Quote
  #5 (permalink)  
Old 10-03-2007
Registered User
 

Join Date: Oct 2007
Posts: 9
Nope... I made the file and upload but when I type in "/root/fileame" I get command not found. How do I know what shell I'm using?
Reply With Quote
  #6 (permalink)  
Old 10-03-2007
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
echo $SHELL will tell which shell are you using.

It would be very helpful if you copy the text you are trying to run as a script, maybe the problem is inside the text (like running a command that doesn't exist).
Reply With Quote
  #7 (permalink)  
Old 10-03-2007
Registered User
 

Join Date: Oct 2007
Posts: 9
Oops.. I just noticed the link I posted earlier was wrong. I'm trying to use the script found in this thread:
Recursive FTP -- here at last.

My shell is bash. Does that mean I need to change the first line in the script?
Reply With Quote
Google UNIX.COM
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0