[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set -- `echo $foo; exit 1` doesn't return the exit code 1
From: |
Paul Jarc |
Subject: |
Re: set -- `echo $foo; exit 1` doesn't return the exit code 1 |
Date: |
Fri, 19 Apr 2002 11:13:35 -0400 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i686-pc-linux-gnu) |
Roland Roeder <roland_roeder@cocreate.com> wrote:
> set -- `echo $foo; exit 1`
>
> doesn't return the exit code 1. I don't know, whether this is
> defined in any standard.
It isn't, AFAICT. The set command itself succeeded, so its exit
status is 0. But this works for me (tested with /bin/sh on Linux,
FreeBSD, NetBSD, OpenBSD, and Solaris):
x=`echo $foo; exit 1`
The exit status of this command is 1. Then you can do "set -- $x".
paul