Subject: Re: RE: [ast-users] How to retrieve result code of command 
substitution  in    assignment?
--------


> Date: Fri, 12 Mar 2010 17:29:44 +0100
> From: [email protected]
> To: [email protected]
> Subject: [ast-users] How to retrieve result code of command substitution in   
> as
signment?
> 
> Hello,
> 
> how could I (in a reliable, portable way) retrieve the exit code of
> the program "urldecode" in the following code fragment:
> 
>      var=$(echo "$url" | urldecode)
> 
> Tests show that the result of the assignment is the result of the
> pipeline started for command substition (here: the exit code of
> "urldecode"). But is this something to depend upon, or is it
> an implementation detail?


This is defined in section 2.9.1 of the standard.

      var=$(echo "$url" | urldecode)

is a simple command.

The last paragraph of this section states:

"If there is no command name, but the command contained a command substitution,
the command shall complete with the exit status of the last command performed."

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to