Process substitution into loop

Grail Dane grail69 at hotmail.com
Fri Jun 10 04:46:45 UTC 2011




> Date: Thu, 9 Jun 2011 21:05:45 -0700
> From: steve.langasek at ubuntu.com
> To: grail69 at hotmail.com
> CC: upstart-devel at lists.ubuntu.com
> Subject: Re: Process substitution into loop
> 
> On Fri, Jun 10, 2011 at 03:53:15AM +0000, Grail Dane wrote:
> > Just wondering, as I can't find by googling, if it is at all possible to
> > do a processsubstitution into a while loop within an upstart script?
> 
> > Example:
> > while read -r DEVICE
> > do
> >    ip link set dev $DEVICE up
> > done< <(ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2})
> 
> > When issuing the start command on the script I get:
> > /proc/self/fd/10: line 6: syntax error near unexpected '<'init:
> > network-interfaces main process (1367) terminated with status 2start: Job
> > failed to start Would appreciated if someone would identify if i have done
> > something wrong or if this not a supported feature?
> 
> The <() syntax is not part of the POSIX standard, it's a bash extension.
> Upstart uses /bin/sh to interpret scripts, as is customary; chances are
> you're running on a system where /bin/sh is not bash, and as a result this
Actually /bin/sh is a symbolic link to bash on my system.  Is there anyway to have bash as theshell used?
> syntax is not supported.
> 
> A supported syntax would be:
> 
>   ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2}' |
>   while read -r DEVICE
>   do
>       ip link set dev $DEVICE up
>   done
> 
> -- 
> Steve Langasek                   Give me a lever long enough and a Free OS
> Debian Developer                   to set it on, and I can move the world.
> Ubuntu Developer                                    http://www.debian.org/
> slangasek at ubuntu.com                                     vorlon at debian.org
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20110610/0b089ba9/attachment.html>


More information about the upstart-devel mailing list