Mercurial > dotfiles
comparison .shell.d/00.path_manipulation.sh @ 490:10811c923fc0
path handling: stop warning when something isn't in a variable
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Mon, 11 Jul 2016 14:54:41 -0400 |
parents | c85072e620a8 |
children | b0fa9e7cadac |
comparison
equal
deleted
inserted
replaced
489:29680270d3fd | 490:10811c923fc0 |
---|---|
27 newcomp="$1" | 27 newcomp="$1" |
28 if echo "$varcontents" | grep "$newcomp:" >> /dev/null; then | 28 if echo "$varcontents" | grep "$newcomp:" >> /dev/null; then |
29 export $varname="`echo $varcontents | sed s%$newcomp:%%`" | 29 export $varname="`echo $varcontents | sed s%$newcomp:%%`" |
30 elif [[ "$varcontents" == "$newcomp" ]] ; then | 30 elif [[ "$varcontents" == "$newcomp" ]] ; then |
31 unset $varname | 31 unset $varname |
32 else | |
33 echo $1 not in $varname | |
34 fi | 32 fi |
35 } | 33 } |
36 | 34 |
37 function append_path_element() { | 35 function append_path_element() { |
38 export PATH="${PATH}:$1" | 36 export PATH="${PATH}:$1" |