Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!math.fu-berlin.de!opal!unido!mikros!mwtech!mecky!walter From: walter@mecky.UUCP (Walter Mecky) Newsgroups: comp.unix.shell Subject: Re: trap 0 in /bin/sh Message-ID: <893@mecky.UUCP> Date: 29 Mar 91 01:02:38 GMT References: <1991Mar27.153352.4421@robobar.co.uk> Reply-To: walter@mecky.UUCP (Walter Mecky) Organization: MIKROS Systemware, Buettelborn/W-Germany Lines: 15 In article <1991Mar27.153352.4421@robobar.co.uk> ronald@robobar.co.uk (Ronald S H Khoo) writes: < Can someone explain why these two commands give different output ? < Is there some subtlety about the "trap" command that I don't understand ? < < $ ( trap 'echo foo' 0 ; true ) < $ ( trap 'echo foo' 0 ; : ) < foo Looks like a bug in sh, ksh executes echo with both commands. I suppose, the subshell for the commands in ( ... ) looks to the last command bevor ) and, if it's not a builtin, does only exec(2), instead of the usual fork(2)/exec(2). So sh cannot execute the trap commands. -- Walter Mecky [ walter@mecky.uucp or ...uunet!unido!mecky!walter ]