diff options
author | Alexander Hall <halex@cvs.openbsd.org> | 2011-07-04 19:52:38 +0000 |
---|---|---|
committer | Alexander Hall <halex@cvs.openbsd.org> | 2011-07-04 19:52:38 +0000 |
commit | e41ebcb137270d8b46969cf640584fcc8d36da2c (patch) | |
tree | 52ba9652d4c903078e79d2f89758fb4593c4f44d /etc | |
parent | 6b5975df90ef00db56bd2152ef4c4db2386350f7 (diff) |
use "function X" rather than "X ()" since for the former, preceding parameter
assignments function calls are not surprisingly polluting your shell environment
"makes sense" krw@, ok tedu@ guenther@
Diffstat (limited to 'etc')
-rw-r--r-- | etc/ksh.kshrc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/etc/ksh.kshrc b/etc/ksh.kshrc index 10f30367484..d836f51394d 100644 --- a/etc/ksh.kshrc +++ b/etc/ksh.kshrc @@ -1,5 +1,5 @@ : -# $OpenBSD: ksh.kshrc,v 1.15 2010/04/26 09:04:15 otto Exp $ +# $OpenBSD: ksh.kshrc,v 1.16 2011/07/04 19:52:37 halex Exp $ # # NAME: # ksh.kshrc - global initialization for ksh @@ -92,15 +92,15 @@ case "$-" in esac # do we want window decorations? if [ "$ILS" ]; then - ilabel () { print -n "${ILS}$*${ILE}">/dev/tty; } - label () { print -n "${WLS}$*${WLE}">/dev/tty; } + function ilabel { print -n "${ILS}$*${ILE}">/dev/tty; } + function label { print -n "${WLS}$*${WLE}">/dev/tty; } alias stripe='label "$USER@$HOST ($tty) - $PWD"' alias istripe='ilabel "$USER@$HOST ($tty)"' - wftp () { ilabel "ftp $*"; "ftp" "$@"; eval istripe; } - wcd () { \cd "$@" && eval stripe; } - wssh () + function wftp { ilabel "ftp $*"; "ftp" "$@"; eval istripe; } + function wcd { \cd "$@" && eval stripe; } + function wssh { local rc "ssh" "$@" @@ -109,7 +109,7 @@ case "$-" in eval stripe return $rc } - wtelnet () + function wtelnet { local rc "telnet" "$@" @@ -118,7 +118,7 @@ case "$-" in eval stripe return $rc } - wrlogin () + function wrlogin { local rc "rlogin" "$@" @@ -127,7 +127,7 @@ case "$-" in eval stripe return $rc } - wsu () + function wsu { local rc "su" "$@" @@ -173,7 +173,7 @@ esac # commands for both interactive and non-interactive shells # is $1 missing from $2 (or PATH) ? -no_path () { +function no_path { eval _v="\$${2:-PATH}" case :$_v: in *:$1:*) return 1;; # no we have it @@ -181,15 +181,15 @@ no_path () { return 0 } # if $1 exists and is not in path, append it -add_path () { +function add_path { [ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1" } # if $1 exists and is not in path, prepend it -pre_path () { +function pre_path { [ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}" } # if $1 is in path, remove it -del_path () { +function del_path { no_path $* || eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: | sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"` } |