On 05 Feb 2011, at 13:47, ali hagigat wrote:
> 
> if (sh -c exit 34) then echo ppppppppp;fi
> ppppppppp
> The following condition should be false, because our exit value is
> non-zero. but 'if' considers the condition as true and executes 'echo'
> command. Why?
> 

You are giving -c the argument 'exit' and setting "34" as the zero'th argument 
to the script.  It's vital to understand what word splitting is.  Quotes are 
used to keep words together so they are passed as a single argument.  -c takes 
only one single argument, so to pass the command exit 34 to -c, you quote it.

Reply via email to