Note the phrase <b>startup behaviour</b> in the paragraph - bash still supports bashisms in its scripts when invoked as sh (after all, that's where the entire historical problem with them comes from)<br><br><div class="gmail_quote">
On Mon, Jun 13, 2011 at 4:56 PM, Grail Dane <span dir="ltr"><<a href="mailto:grail69@hotmail.com">grail69@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">




<div>
<font face="Tahoma" size="2">Hi James</font><div style="font-family:Tahoma;font-size:10pt"><br></div><div style="font-family:Tahoma;font-size:10pt">Thanks very much for the reply.  As you can probably guess the typo is in the email but not in</div>
<div style="font-family:Tahoma;font-size:10pt">the actual script.  I did further testing and as per the bash install instructions:</div><div style="font-family:Tahoma;font-size:10pt"><br></div><div style="font-family:Tahoma;font-size:10pt">
<span style="color:rgb(34, 34, 34);font-family:verdana, tahoma, helvetica, arial, sans-serif;font-size:16px;line-height:19px"><table border="0" style="width:auto;margin-right:1em;margin-bottom:0px;margin-left:1em"><tbody><tr>
<td style="vertical-align:top"><p style="padding-left:1em;padding-right:1em;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><span style="margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><span style="font-family:monospace;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><strong>sh</strong></span></span></p>
</td><td style="vertical-align:top"><p style="padding-left:1em;padding-right:1em;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em">A symlink to the <span style="font-family:monospace;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><strong>bash</strong></span> program; when invoked as <span style="font-family:monospace;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><strong>sh</strong></span>, <span style="font-family:monospace;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><strong>bash</strong></span> tries to mimic the startup behavior of historical versions of <span style="font-family:monospace;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><strong>sh</strong></span> as closely as possible, while conforming to the POSIX standard as well</p>
<p style="padding-left:1em;padding-right:1em;margin-right:0.25em;margin-bottom:0.25em;margin-left:0.25em"><br></p></td></tr></tbody></table></span><br></div><div style="font-family:Tahoma;font-size:10pt">This would indicate that it is a bash builtin feature to use only POSIX compliant options.</div>
<div style="font-family:Tahoma;font-size:10pt">So from the Cookbook you may need to edit the following from the section you pointed me to:</div><div style="font-family:Tahoma;font-size:10pt"><br></div><div style="font-family:Tahoma;font-size:10pt">
<span style="font-family:Ubuntu, 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;font-size:12pt">If you wish to change this, you can either make</span><span style="font-family:Ubuntu, 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;font-size:12pt"> </span><span style="font-family:Ubuntu, 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;font-size:12pt"><tt>/bin/sh</tt></span><span style="font-family:Ubuntu, 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;font-size:12pt"> </span><span style="font-family:Ubuntu, 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;font-size:12pt">a symbolic link to your chosen shell</span></div>
<div><font face="Ubuntu, 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif"><br></font></div><div><font face="Tahoma">As this does not work as expected in this case and it may be similar for other shells to.</font></div>
<div><font face="Tahoma"><br></font></div><div><font face="Tahoma">I will try the workaround of adding it as the default shell in the build and let you know how it goes :)<br></font><div style="font-family:Tahoma;font-size:10pt">
</div><font face="Tahoma" size="2"><br></font></div><div><font face="Tahoma" size="2">Cheers</font></div><div><font face="Tahoma" size="2">grail</font></div><div><font face="Tahoma" size="2"><br></font></div><div><font face="Tahoma" size="2">> Date: Fri, 10 Jun 2011 11:22:12 +0100</font><br>
<font face="Tahoma" size="2">> From: <a href="mailto:james.hunt@ubuntu.com" target="_blank">james.hunt@ubuntu.com</a></font><div><div></div><div class="h5"><br><font face="Tahoma" size="2">> To: <a href="mailto:grail69@hotmail.com" target="_blank">grail69@hotmail.com</a></font><br>
<font face="Tahoma" size="2">> CC: <a href="mailto:upstart-devel@lists.ubuntu.com" target="_blank">upstart-devel@lists.ubuntu.com</a></font><br><font face="Tahoma" size="2">> Subject: Re: Process substitution into loop</font><br>
<font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> Hi Grail,</font><br><font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> On 10/06/11 05:46, Grail Dane wrote:</font><br>
<font face="Tahoma" size="2">> > </font><br><font face="Tahoma" size="2">> > </font><br><font face="Tahoma" size="2">> >> Date: Thu, 9 Jun 2011 21:05:45 -0700</font><br><font face="Tahoma" size="2">> >> From: <a href="mailto:steve.langasek@ubuntu.com" target="_blank">steve.langasek@ubuntu.com</a></font><br>
<font face="Tahoma" size="2">> >> To: <a href="mailto:grail69@hotmail.com" target="_blank">grail69@hotmail.com</a></font><br><font face="Tahoma" size="2">> >> CC: <a href="mailto:upstart-devel@lists.ubuntu.com" target="_blank">upstart-devel@lists.ubuntu.com</a></font><br>
<font face="Tahoma" size="2">> >> Subject: Re: Process substitution into loop</font><br><font face="Tahoma" size="2">> >></font><br><font face="Tahoma" size="2">> >> On Fri, Jun 10, 2011 at 03:53:15AM +0000, Grail Dane wrote:</font><br>
<font face="Tahoma" size="2">> >> > Just wondering, as I can't find by googling, if it is at all possible to</font><br><font face="Tahoma" size="2">> >> > do a processsubstitution into a while loop within an upstart script?</font><br>
<font face="Tahoma" size="2">> >></font><br><font face="Tahoma" size="2">> >> > Example:</font><br><font face="Tahoma" size="2">> >> > while read -r DEVICE</font><br><font face="Tahoma" size="2">> >> > do</font><br>
<font face="Tahoma" size="2">> >> > ip link set dev $DEVICE up</font><br><font face="Tahoma" size="2">> >> > done< <(ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2})</font><br>
<font face="Tahoma" size="2">> You have an error in your script: it is missing the closing tick (see below).</font><br><font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> >></font><br><font face="Tahoma" size="2">> >> > When issuing the start command on the script I get:</font><br>
<font face="Tahoma" size="2">> >> > /proc/self/fd/10: line 6: syntax error near unexpected '<'init:</font><br><font face="Tahoma" size="2">> >> > network-interfaces main process (1367) terminated with status 2start: Job</font><br>
<font face="Tahoma" size="2">> >> > failed to start Would appreciated if someone would identify if i have done</font><br><font face="Tahoma" size="2">> >> > something wrong or if this not a supported feature?</font><br>
<font face="Tahoma" size="2">> >></font><br><font face="Tahoma" size="2">> >> The <() syntax is not part of the POSIX standard, it's a bash extension.</font><br><font face="Tahoma" size="2">> >> Upstart uses /bin/sh to interpret scripts, as is customary; chances are</font><br>
<font face="Tahoma" size="2">> >> you're running on a system where /bin/sh is not bash, and as a result this</font><br><font face="Tahoma" size="2">> > </font><br><font face="Tahoma" size="2">> > Actually /bin/sh is a symbolic link to bash on my system.  Is there anyway to have bash as the</font><br>
<font face="Tahoma" size="2">> > shell used?</font><br><font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> script</font><br><font face="Tahoma" size="2">> /bin/bash <<EOT</font><br>
<font face="Tahoma" size="2">> while read -r DEVICE</font><br><font face="Tahoma" size="2">> do</font><br><font face="Tahoma" size="2">>     echo "DEBUG: ip link set dev $DEVICE up" > /tmp/grail.log</font><br>
<font face="Tahoma" size="2">> done < <(ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2}')</font><br><font face="Tahoma" size="2">> EOT</font><br><font face="Tahoma" size="2">> end script</font><br>
<font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> Also, just for you :)...</font><br><font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> <a href="http://upstart.ubuntu.com/cookbook/#changing-the-default-shell" target="_blank">http://upstart.ubuntu.com/cookbook/#changing-the-default-shell</a></font><br>
<font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> Regards,</font><br><font face="Tahoma" size="2">> </font><br><font face="Tahoma" size="2">> James.</font><br><font face="Tahoma" size="2">> </font><br>
<font face="Tahoma" size="2">> > </font><br><font face="Tahoma" size="2">> >> syntax is not supported.</font><br><font face="Tahoma" size="2">> >></font><br><font face="Tahoma" size="2">> >> A supported syntax would be:</font><br>
<font face="Tahoma" size="2">> >></font><br><font face="Tahoma" size="2">> >> ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2}' |</font><br><font face="Tahoma" size="2">> >> while read -r DEVICE</font><br>
<font face="Tahoma" size="2">> >> do</font><br><font face="Tahoma" size="2">> >> ip link set dev $DEVICE up</font><br><font face="Tahoma" size="2">> >> done</font><br><font face="Tahoma" size="2">> >></font><br>
<font face="Tahoma" size="2">> >> --</font><br><font face="Tahoma" size="2">> >> Steve Langasek Give me a lever long enough and a Free OS</font><br><font face="Tahoma" size="2">> >> Debian Developer to set it on, and I can move the world.</font><br>
<font face="Tahoma" size="2">> >> Ubuntu Developer <a href="http://www.debian.org/" target="_blank">http://www.debian.org/</a></font><br><font face="Tahoma" size="2">> >> <a href="mailto:slangasek@ubuntu.com" target="_blank">slangasek@ubuntu.com</a> <a href="mailto:vorlon@debian.org" target="_blank">vorlon@debian.org</a></font><br>
<font face="Tahoma" size="2">> > </font><br><font face="Tahoma" size="2">> </font><br></div></div></div>                                           </div>
<br>--<br>
upstart-devel mailing list<br>
<a href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
<br></blockquote></div><br>