delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/10/31/22:52:45

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <508FE401.3090906@cs.umass.edu>
Date: Tue, 30 Oct 2012 10:28:17 -0400
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Reply-To: moss AT cs DOT umass DOT edu
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Command line arguments
References: <1351606847888-94081 DOT post AT n5 DOT nabble DOT com>
In-Reply-To: <1351606847888-94081.post@n5.nabble.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 10/30/2012 10:20 AM, chesschi wrote:

 > 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.

It is not clear what you mean by "in cygwin".  If you run the bash shell,
for example, then it indeed makes the various arguments available as $1,
etc., and $# works as expected.

Perhaps you should give us more detail. I would suggest including:

- the script
- telling us the program from which you invoke the script (bash?), and
   exactly how you invoke it
- one or more of the command lines that do not seem to work as you expect

I can assure you that I use bash and bash scripts, with arguments and
fancy argument processing, all the time ...

Regards -- Eliot Moss

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019