The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
passing arguments from shell to java kenpeter UNIX for Dummies Questions & Answers 3 05-19-2008 06:54 PM
Passing arguments to a shell script from file while scheduling in cron weblogicsupport SUN Solaris 4 01-27-2008 11:16 PM
Passing blank arguments to a script rm-r UNIX for Advanced & Expert Users 7 01-08-2008 08:56 PM
Passing arguments to a Perl script jyoung Shell Programming and Scripting 4 12-29-2004 05:57 PM
Passing arguments to a script Kevin Pryke Shell Programming and Scripting 3 06-14-2002 09:06 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-16-2006
santy santy is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 11
passing runtime arguments to a shell script...

hi I am new to shell programming.....my question is while running one of my shell program it stops in between to accept input from the user and proceeds furthur after giving input....I want to know whether I can set this input through some files so that the shell acript reads the input from the file and will not prompt the user to input the required data...the input is a text...is there any other possibilities using pipes....

thanks in advance
  #2 (permalink)  
Old 08-16-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,929
This is basic file redirection.

Code:
./script.sh < input-file
  #3 (permalink)  
Old 08-16-2006
santy santy is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 11
will this command automatically takes the input from the input-file...should i append this line to the end of the script....thanks for ur reply...
  #4 (permalink)  
Old 08-16-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,929
Quote:
Originally Posted by santy
Will this command automatically take the input from the input-file? Should I append this line to the end of the script? Thanks for your reply.
Yes, it will automatically take the input from the input file. It's not telling the program to do so, the shell automatically feeds the file into it's input when it creates the process. You can add that to the end of your script, if that's what you wish the script to do. You can even feed the output of one program into the input of another with pipes:
Code:
./script.sh | ./script2.sh
  #5 (permalink)  
Old 08-16-2006
santy santy is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 11
thanks a lot:-)
  #6 (permalink)  
Old 01-09-2009
kany2k kany2k is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
Hi,

Have you guys anyone worked on CA workload, i have rqmnt that UNIX script should accept the parameter passed through the CA workload and run the process. To explain in the detail CA workload will tell which files is being placed on the server if file1 is placed it needs to process file1 and if file2 is placed it has to process it and so on. Any help would be appreciated.
  #7 (permalink)  
Old 01-09-2009
Padow Padow is offline
Registered User
  
 

Join Date: Dec 2008
Location: Maryland
Posts: 178
You can use the getopts command to handle command line arguments.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0