aboutsummaryrefslogtreecommitdiffstats
path: root/include/shell.sh
blob: 8f6f6f04bb414e5dc24851d6dceefe8d282782f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
getvar() {
	eval "echo \"\${$1}\""
}

var2file() {
	local var
	eval "var=\"\${$1}\""
	if [ -n "$var" ]; then echo "$var" > "$2"; fi
}

isset() {
	local var
	eval "var=\"\${$1}\""
	[ -n "$var" ]
}

md5s() {
	cat "$@" | (
		md5sum 2>/dev/null ||
		md5
	) | awk '{print $1}'
}