X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org From: "Brian Wilson" To: cygwin AT cygwin DOT com Subject: Re: Command line arguments Date: Wed, 31 Oct 2012 13:23:58 -0500 Message-Id: <20121031182143.M67652@ds.net> In-Reply-To: <1351606847888-94081.post@n5.nabble.com> References: <1351606847888-94081 DOT post AT n5 DOT nabble DOT com> X-OriginatingIP: 158.111.236.102 (wilson) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT 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