summaryrefslogtreecommitdiff
path: root/jh.sh
blob: ca580a34257d6b70b4e02787dd34662eeec1db2e (plain)
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
#!/bin/bash

if [[ -z $JH_PATH ]]; then
	export JH_PATH=/usr/share/jh
fi

if [[ -z $jh_short ]]; then
	export jh_short=${0##*/}
	export PATH="$JH_PATH:$PATH"
fi

main() {
	if [[ $# < 1 ]]; then
		jh-help >>/dev/stderr
		return 1;
	fi
	cmd=$1
	shift

	if [[ -x "$(which "jh-$cmd" 2>/dev/null)" ]]; then
		"jh-$cmd" "$@"
		return $?
	else
		echo "$jh_short: Cannot find command '$cmd'" >> /dev/stderr
	fi
}

main "$@"