🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #71

ksh's trap "" ERR

#71
From: James Van Artsdalen
Date: Tue, 13 Jun 1989 17:51
26 lines
1205 bytes
On feature I miss from ksh is 'trap "" ERR'.  For example, my .ksh
file has

trap 'echo "(ERR:$?)"' ERR

I tried to simulate this in bash with PROMPT_COMMAND, but it didn't
work.  Here's an emacs M-x shell script: it starts out in ksh, and
then runs bash.

/tmp> (exit 1)
(ERR:1)
/tmp> /usr/local/src/dist-bash/bash
/tmp> PROMPT_COMMAND='if [ $? -ne 0 ] ; then echo "(ERR:$?)" ; fi'
PPROMPT_COMMAND='if [ $? -ne 0 ] ; then echo "(ERR:$?)" ; fi'
/tmp> 

/tmp> (exit 1)
((exit 1)
/tmp> 

bash doesn't print the error status.  Also note that bash doesn't
behave well under emacs, but I assume this is related to previous
reported bugs with determining interactive status.
-- 
James R. Van Artsdalen          james@bigtex.cactus.org   "Live Free or Die"
Dell Computer Co    9505 Arboretum Blvd Austin TX 78759         512-338-8789
Technical Details
Message-ID: <18026@bigtex.cactus.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!milano!bigtex!james

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!milano!bigtex!james
From: james@bigtex.cactus.org (James Van Artsdalen)
Newsgroups: gnu.bash.bug
Subject: ksh's trap "" ERR
Message-ID: <18026@bigtex.cactus.org>
Date: 13 Jun 89 17:51:14 GMT
Organization: Institute of Applied Cosmology, Austin TX
Lines: 26