Command line arguments

Brian Wilson wilson@ds.net
Wed Oct 31 18:24:00 GMT 2012


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



More information about the Cygwin mailing list