delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/01/18/03:23:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <006c01c19ff9$6299e350$ec00a8c0@mchasecompaq>
From: "Michael A Chase" <mchase AT ix DOT netcom DOT com>
To: "Surendar Singh Bisht" <suren AT duncaninfotech DOT com>, <cygwin AT cygwin DOT com>
Cc: "Corinna Vinschen" <cygwin AT cygwin DOT com>, <chet AT po DOT CWRU DOT Edu>
References: <5100B8473B3ED511B22B009027DE29093CF16C AT AKASH>
Subject: Re: A small problem in Shell Scripts while using the built-in "read" function -- Options not recognised
Date: Fri, 18 Jan 2002 00:13:43 -0800
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

From 'man bash':

       -c string If  the  -c option is present, then commands are
                 read from string.  If there are arguments  after
                 the  string, they are assigned to the positional
                 parameters, starting with $0.
. . .
ARGUMENTS
       If  arguments  remain after option processing, and neither
       the -c nor the -s option  has  been  supplied,  the  first
       argument  is  assumed  to be the name of a file containing
       shell commands.  If bash is invoked in this fashion, $0 is
       set to the name of the file, and the positional parameters
       are set to the remaining arguments.  Bash reads  and  exe-
       cutes  commands  from  this file, then exits.  Bash's exit
       status is the exit status of the last command executed  in
       the  script.  If no commands are executed, the exit status
       is 0.  An attempt is first made to open the  file  in  the
       current  directory,  and,  if  no  file is found, then the
       shell searches the directories in PATH for the script.

===
Which for is used is mostly a mater of taste.  The effect is slightly
different though.
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.
----- Original Message -----
From: "Surendar Singh Bisht" <suren AT duncaninfotech DOT com>
To: <cygwin AT cygwin DOT com>
Cc: "Corinna Vinschen" <cygwin AT cygwin DOT com>; <chet AT po DOT CWRU DOT Edu>
Sent: Thursday, January 17, 2002 22:03
Subject: RE: A small problem in Shell Scripts while using the built-in
"read" function -- Options not recognised


> Corinna Thanks !! & Thanks Chet!!
>
> The Workaround is doing great.
>
> Now the things are back in the places.
>
> -----Original Message-----
> From: Chet Ramey [mailto:chet AT nike DOT ins DOT cwru DOT edu]
> Sent: Thursday, 17 January 2002 7:52 PM
> To: cygwin AT cygwin DOT com
> Subject: Re: A small problem in Shell Scripts while using the built-in
> "read" function -- Options not recognised
>
>
> > The script is running under sh which is ash, not bash. ash doesn't
> > know these `read' options.  As workaround prepend
> >
> > #!/bin/bash
> >
> > to your script or start it via `bash -c script'.
>
> Why the `-c'?  `bash script' should work just fine.




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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