This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Command line arguments
- From: "Brian Wilson" <wilson at ds dot net>
- To: cygwin at cygwin dot com
- Date: Wed, 31 Oct 2012 13:23:58 -0500
- Subject: Re: Command line arguments
- References: <1351606847888-94081.post@n5.nabble.com>
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