[314] in linux-announce channel archive

home help back first fref pref prev next nref lref last post

"bash -c 'exit 5'" gives 127 !

daemon@ATHENA.MIT.EDU (Lars Wirzenius)
Sat Mar 18 12:08:13 1995

Date: Sat, 18 Mar 1995 17:08:14 +0200
From: Lars Wirzenius <wirzeniu@cc.helsinki.fi>
To: linux-activists@niksula.hut.fi, linux-announce@vger.rutgers.edu

X-Mn-Key: announce

From: leitner@inf.fu-berlin.de (Felix von Leitner)
Newsgroups: comp.os.linux.announce
Subject: "bash -c 'exit 5'" gives 127 !
Organization: Freie Universitaet Berlin
Keywords: Bash, bug, exit code
Approved: linux-announce@news.ornl.gov (Lars Wirzenius)
Followup-to: comp.os.linux.misc

Hi Folks !

While trying to compile Andrew and some other large projects with huge
makefile systems using /bin/sh under Linux (where /bin/sh is bash), I
found this strange behaviour :

  $ sh -c 'exit 5' ; echo $?
  127
  $

This broke all makefiles using "sh -c".  So I began tracing this in bash
and found that it is no bug, it's a features ;)  At least it looks like
it was meant this way.  But I find it not only strange, I find it wrong.
Under all other Unixes I could try it on, it worked like expected,
returning 5.  Well, if somebody else wants to correct this in
bash-1.14.3, this is the diff for shell.c

Felix

---
1036d1035
< 	case EXITPROG:
1037a1037,1038
> 	case EXITPROG:
> 	  return last_command_exit_value;
---

--
If Rush Limbaugh doesn't need a disclaimer, neither do I.
"Who is General Failure and why is he reading my hard disk ?"
  Microsoft spel chekar vor sail, worgs grate !!

--
Send submissions for comp.os.linux.announce to: linux-announce@news.ornl.gov
PLEASE remember Keywords: and a short description of the software.


home help back first fref pref prev next nref lref last post