Compilation config change...
[tomato.git] / toolchain / include / shell.sh
blobf6be6c526f26fb489cc660d7201bce3c3a1117b7
1 getvar() {
2 eval "echo \"\${$1}\""
5 var2file() {
6 local var
7 eval "var=\"\${$1}\""
8 if [ -n "$var" ]; then echo "$var" > "$2"; fi
11 isset() {
12 local var
13 eval "var=\"\${$1}\""
14 [ -n "$var" ]
17 trapret() {(
18 local retvals="$1"; shift
19 local cmd="$1"; shift
20 for retval in $(echo $retvals); do
21 local trap_$retval=1
22 done
23 "$cmd" "$@" || {
24 local retval="$?"
25 eval "trapped=\${trap_$retval}"
26 [ -n "$trapped" ] || {
27 return $retval
32 md5s() {
33 which md5sum 2>&1 >/dev/null && md5sum "$@" | awk '{print $1}' || md5 "$@"