-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathset.sh
34 lines (34 loc) · 814 Bytes
/
set.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
## set - set bash behavior
## version 0.0.1 - initial, import
##################################################
set_exit_on_error() { __set exit on error ; }
#-------------------------------------------------
__set() {
. ${SH}/attr.sh
option_name=option_${RANDOM}
option_value=option_${RANDOM}
eval ${option_name}=${option_value}
attr ${option_name}
##################################################
_set() {
case $( get_${option_name} ) in
"exit on error") set -e ;;
*) false ;;
esac
}
##################################################
## $1 - option
if [ ${#} -ge 1 ]
then
set_${option_name} ${*}
_set || {
echo option \"${*}\" no supported
false
}
##################################################
else
exit 1 # wrong args
fi
##################################################
}