Things like var=value do not produce output that can be piped. One can say that the construct a=2|something is a syntax error, as opposed to a=2 something which is valid. {} do not produce a new scope, they only
group instructions. Imho writing:

  a=1; { a=2; echo $a; }; echo $a

is more correct than:

  a=1; { a=2|cat; }; echo $a

If you need the exit status and a result you can use:

  cmd="echo -e"
  result="`$cmd $args`"; status=$?
  [ $status ] && [ $LOG_ERRORS ] \
        "Argh: $?: $cmd($args): (result='$result')"|logger ...
  [ $status -eq 0 ] && [ $LOG_SUCCESS ] \
        "Yeah: $cmd($args): (result='$result')"|logger ...

If you need namespace isolation use a=1; (a=13; echo $a); echo $a

Peter



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to