This is the mail archive of the
mailing list for the Cygwin project.
Re: A small problem in Shell Scripts while using the built-in "read" function -- Options not recognised
- 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>
- Date: Fri, 18 Jan 2002 00:13:43 -0800
- Subject: Re: A small problem in Shell Scripts while using the built-in "read" function -- Options not recognised
- References: <5100B8473B3ED511B22B009027DE29093CF16C@AKASH>
>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.
. . .
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
** 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" <firstname.lastname@example.org>
Cc: "Corinna Vinschen" <email@example.com>; <chet@po.CWRU.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:firstname.lastname@example.org]
> Sent: Thursday, 17 January 2002 7:52 PM
> To: email@example.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