Browse Source

Identation

OK halex, krw
OPENBSD_6_1
rpe 8 years ago
parent
commit
bd8116bbf7
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      src/etc/ksh.kshrc

+ 10
- 10
src/etc/ksh.kshrc View File

@ -1,5 +1,5 @@
: :
# $OpenBSD: ksh.kshrc,v 1.22 2016/09/09 16:25:37 rpe Exp $
# $OpenBSD: ksh.kshrc,v 1.23 2016/09/10 08:00:12 rpe Exp $
# #
# NAME: # NAME:
# ksh.kshrc - global initialization for ksh # ksh.kshrc - global initialization for ksh
@ -131,22 +131,22 @@ esac
# is $1 missing from $2 (or PATH) ? # is $1 missing from $2 (or PATH) ?
function no_path { function no_path {
eval _v="\$${2:-PATH}"
case :$_v: in
*:$1:*) return 1;; # no we have it
esac
return 0
eval _v="\$${2:-PATH}"
case :$_v: in
*:$1:*) return 1;; # no we have it
esac
return 0
} }
# if $1 exists and is not in path, append it # if $1 exists and is not in path, append it
function add_path { function add_path {
[[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1"
[[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}:$1"
} }
# if $1 exists and is not in path, prepend it # if $1 exists and is not in path, prepend it
function pre_path { function pre_path {
[[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}"
[[ -d ${1:-.} ]] && no_path $* && eval ${2:-PATH}="$1:\$${2:-PATH}"
} }
# if $1 is in path, remove it # if $1 is in path, remove it
function del_path { function del_path {
no_path $* || eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: |
sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"`
no_path $* || eval ${2:-PATH}=`eval echo :'$'${2:-PATH}: |
sed -e "s;:$1:;:;g" -e "s;^:;;" -e "s;:\$;;"`
} }

Loading…
Cancel
Save