This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Command line arguments


If you have a script (e.g. foo.sh) and you wish to pass arguments to the 
script, your command line should look like "foo.sh arg1 arg2 arg3..."  The 
number of arguments will be correct and you will be able to access them as 
${1}, ${2}, etc.  Also, you may want to read up on the getopts command as a 
way to process command line arguments.

Sincerely,

Brian S. Wilson
============================================================================

> In cygwin, is it possible to pass arguments to a shell script file? 
> I have installed the latest cygwin with default packages. I found 
> that argument zero ($0) is correct. However, the number of arguments 
> always returns zero
> ($#= 0) and $1, $2... are all null even though I did pass arguments.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]