This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: #!/bin/sh and #!/bin/bash is not the same
- From: Morten Kjærulff <mortenkjarulff at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 22 Aug 2016 16:36:13 +0200
- Subject: Re: #!/bin/sh and #!/bin/bash is not the same
- Authentication-results: sourceware.org; auth=none
- References: <CA+7cx1oHkwK8vOV+2heYAhw=DhkrRfEvkbaj2pmH+x29ZP0T7Q@mail.gmail.com> <fd1a102b-9df8-24b7-8440-9842b614fc6c@gmail.com>
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