Created
November 1, 2013 11:11
-
-
Save iandelahorne/7264014 to your computer and use it in GitHub Desktop.
/etc/profile.d/sbin.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path_elems=(${PATH//:/ }) | |
sbin_missing=1 | |
usr_sbin_missing=1 | |
usr_local_sbin_missing=1 | |
for i in "${!path_elems[@]}" ; do | |
if [ "${path_elems[i]}" = /sbin ]; then sbin_missing = 0 ; fi | |
if [ "${path_elems[i]}" = /usr/sbin ]; then usr_sbin_missing = 0 ; fi | |
if [ "${path_elems[i]}" = /usr/local/sbin ]; then usr_local_sbin_missing = 0 ; fi | |
done | |
if [ $sbin_missing -gt 0 ] ; then | |
PATH=/sbin:$PATH | |
fi | |
if [ $usr_sbin_missing -gt 0 ] ; then | |
PATH=/usr/sbin:$PATH | |
fi | |
if [ $usr_local_sbin_missing -gt 0 ] ; then | |
PATH=/usr/local/sbin:$PATH | |
fi | |
unset path_elems | |
unset sbin_missing | |
unset usr_sbin_missing | |
unset usr_local_sbin_missing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment