bug-bash
[Top][All Lists]
Advanced

[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: Roland Roeder
Subject: Re: set -- `echo $foo; exit 1` doesn't return the exit code 1
Date: Mon, 22 Apr 2002 07:29:05 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020314 Netscape6/6.2.2

Thanks, for this hint Paul! That works fine for me too.

  Roland

address@hidden wrote:

Roland Roeder <address@hidden> 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




--
________________________________________________________________________

Roland Roeder                       E-mail: address@hidden
                                    Phone: 07031-951-2199
CoCreate Software GmbH              FAX:   07031-951-2320
Posener Str. 1
71065 Sindelfingen
Germany
________________________________________________________________________




reply via email to

[Prev in Thread] Current Thread [Next in Thread]