precmd is required to retain the errorlevel when ${ …;} is used

This commit is contained in:
tg 2013-01-21 15:06:24 +00:00
parent 9111faeeb5
commit 72c895c4a1

View File

@ -1,8 +1,8 @@
# $Id$
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.73 2012/11/30 20:19:10 tg Exp $
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.74 2013/01/21 15:06:24 tg Exp $
#-
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
# 2011, 2012, 2013
# Thorsten Glaser <tg@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
@ -29,6 +29,8 @@ function precmd {
local e=$?
(( e )) && print -n "$e|"
# precmd is required to retain the errorlevel when ${ …;} is used
return $e
}
PS1=$'\001\r''${ precmd;}${USER:=$(ulimit -c 0; id -un 2>/dev/null || echo \?
)}@${HOSTNAME%%.*}:$(local d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || \