bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

set -- `echo $foo; exit 1` doesn't return the exit code 1


From: Roland Roeder
Subject: set -- `echo $foo; exit 1` doesn't return the exit code 1
Date: Fri, 19 Apr 2002 11:16:29 +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

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: cygwin
Compiler: i686-pc-cygwin-gcc
Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='
cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFI
G_H   -I.  -I../bash-2.05a -I../bash-2.05a/include -I../bash-2.05a/lib -g -O2
uname output: Windows_NT D10PC474 1.3.9(0.51/3/2) 2002-01-21 12:48 i686 unknown
Machine Type: i686-pc-cygwin

Bash Version: 2.05a
Patch Level: 0
Release Status: release

Description:
 Hi there,

  The following line of code

  set -- `echo $foo; exit 1`

  doesn't return the exit code 1. I don't know, whether this is defined in any
  standard. But I've checked this in different shells (HPUX/SUN/MKS). They
  all return the desired exit code. We rely on this since we have lots of
  tools in use which uses getopt:

  set -- `getopt b:vf $*`
  if [ $? -ne 0 ] ; then
    echo "Usage: ....."
    exit 2
  fi

  We have written an emulation for getopt which sets the exit code properly and
  want to check the exit code to see whether a correct argument line was passed 
to
  a script.

  We know, that changing the scripts to use getopts instead of getopt would
  solve the problem. But this would mean a tremendous effort for us.

Repeat-By:
  set -- `echo $foo; exit 1`
  echo $?

Regrads,
  Roland
--
________________________________________________________________________

Roland Roeder                       E-mail: roland_roeder@cocreate.com
                                    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]