diff options
author | Alexander Hall <halex@cvs.openbsd.org> | 2014-07-11 21:12:40 +0000 |
---|---|---|
committer | Alexander Hall <halex@cvs.openbsd.org> | 2014-07-11 21:12:40 +0000 |
commit | 652022f3d4f6867978fa8f06f0ee51613193d51d (patch) | |
tree | 9cdcdd101508a5fc3c01ad456df79318b8fcc96d /etc | |
parent | 61fc1c8de507b24dd2efd2a28a035454b4900677 (diff) |
Introducing a nifty _ignore function makes the file neater and easier
to maintain. The eval's must stay to make the aliases expand at run
time instead of at parse time.
ok krw@
Diffstat (limited to 'etc')
-rw-r--r-- | etc/ksh.kshrc | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/etc/ksh.kshrc b/etc/ksh.kshrc index 78f71456c81..f825b430fae 100644 --- a/etc/ksh.kshrc +++ b/etc/ksh.kshrc @@ -1,5 +1,5 @@ : -# $OpenBSD: ksh.kshrc,v 1.18 2014/07/11 16:41:16 halex Exp $ +# $OpenBSD: ksh.kshrc,v 1.19 2014/07/11 21:12:39 halex Exp $ # # NAME: # ksh.kshrc - global initialization for ksh @@ -98,44 +98,18 @@ case "$-" in alias stripe='label "$USER@$HOST ($tty) - $PWD"' alias istripe='ilabel "$USER@$HOST ($tty)"' - function wftp { ilabel "ftp $*"; "ftp" "$@"; eval istripe; } - function wcd { \cd "$@" && eval stripe; } - function wssh - { - local rc - "ssh" "$@" - rc=$? - eval istripe - eval stripe - return $rc - } - function wtelnet - { - local rc - "telnet" "$@" - rc=$? - eval istripe - eval stripe - return $rc - } - function wrlogin - { - local rc - "rlogin" "$@" - rc=$? - eval istripe - eval stripe - return $rc - } - function wsu - { - local rc - "su" "$@" - rc=$? - eval istripe - eval stripe - return $rc - } + # Run stuff through this to preserve the exit code + function _ignore { local rc=$?; "$@"; return $rc; } + + function wftp { ilabel "ftp $*"; "ftp" "$@"; _ignore eval istripe; } + + function wcd { \cd "$@"; _ignore eval stripe; } + + function wssh { \ssh "$@"; _ignore eval 'istripe; stripe'; } + function wtelnet { \telnet "$@"; _ignore eval 'istripe; stripe'; } + function wrlogin { \rlogin "$@"; _ignore eval 'istripe; stripe'; } + function wsu { \su "$@"; _ignore eval 'istripe; stripe'; } + alias su=wsu alias cd=wcd alias ftp=wftp |