This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: #!/bin/sh and #!/bin/bash is not the same


Thanks.

What I was actually trying, was this:

echo a | while read ; do
  some_command &
done
wait

The "wait" did not wait. I guessed the reason was that "some_command
&" was executed in a subshell.

So I tried:

while read ; do
  some_command &
done < <(echo a)
wait

It was working, however not with #!/bin/sh

/Morten



On Mon, Aug 22, 2016 at 3:16 PM, cyg Simple <cygsimple@gmail.com> wrote:
> On 8/20/2016 1:42 PM, Morten Kjærulff wrote:
>> Hi,
>>
>> I thought that #!/bin/sh in a script would be a bash, but it seems not
>> to be - or what am I doing wrong?
>>
>
> If you want to ensure that you have a particular flavor of shell then
> don't use /bin/sh.  The reason to use /bin/sh is that POSIX ensures it
> exists but it doesn't have to be bash, even on Linux.  For a generic
> shell script use ksh syntax, you'll find that it gets you further and is
> supported by bash.
>
> --
> cyg Simple
>
> --
> 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
>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]