From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25579 invoked by alias); 31 Oct 2012 18:24:08 -0000 Received: (qmail 25569 invoked by uid 22791); 31 Oct 2012 18:24:07 -0000 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 Received: from s01.ds.net (HELO mail.ds.net) (204.13.151.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 31 Oct 2012 18:23:59 +0000 Received: from ds.net (localhost.localdomain [127.0.0.1]) by mail.ds.net (8.14.2/8.14.2) with ESMTP id q9VINwmJ011644 for ; Wed, 31 Oct 2012 14:23:58 -0400 From: "Brian Wilson" To: cygwin@cygwin.com Subject: Re: Command line arguments Date: Wed, 31 Oct 2012 18:24:00 -0000 Message-Id: <20121031182143.M67652@ds.net> In-Reply-To: <1351606847888-94081.post@n5.nabble.com> References: <1351606847888-94081.post@n5.nabble.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@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2012-10/txt/msg00481.txt.bz2 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