[util-msg] add error handling for import()

This commit is contained in:
udeved 2015-06-12 00:29:16 +02:00
parent 6ed34f132f
commit f98c71927b

View file

@ -11,10 +11,6 @@
export LC_MESSAGES=C export LC_MESSAGES=C
export LANG=C export LANG=C
import(){
[[ -r $1 ]] && source $1
}
# check if messages are to be printed using color # check if messages are to be printed using color
unset ALL_OFF BOLD BLUE GREEN RED YELLOW CYAN MAGENTA WHITE unset ALL_OFF BOLD BLUE GREEN RED YELLOW CYAN MAGENTA WHITE
if [[ -t 2 ]]; then if [[ -t 2 ]]; then
@ -118,3 +114,11 @@ slock() {
stat_done stat_done
fi fi
} }
import(){
if [[ -r $1 ]];then
source $1
else
die "Could not import $1"
fi
}