Subject: Re: A small problem in Shell Scripts while using the built-in "read" function -- Options not recognised
From: "Michael A Chase" <[email-masked]>
To: "Surendar Singh Bisht" <[email-masked]>, <[email-masked]>
Cc: "Corinna Vinschen" <[email-masked]>, <[email-masked]>
Date: Fri, 18 Jan 2002 00:13:43 -0800

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" <[email-masked]>
To: <[email-masked]>
Cc: "Corinna Vinschen" <[email-masked]>; <[email-masked]>
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:[email-masked]]
> Sent: Thursday, 17 January 2002 7:52 PM
> To: [email-masked]
> 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/