forked from superhj1987/awesome-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopscripts
More file actions
executable file
·32 lines (24 loc) · 770 Bytes
/
opscripts
File metadata and controls
executable file
·32 lines (24 loc) · 770 Bytes
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
#!/bin/bash
export OPSCRIPTS_DIR=$(dirname $0)
# load common lib functions
source $OPSCRIPTS_DIR/opscripts-common.sh
if [ $# = 0 ];then
print_column 'Usage '
print_column " opscripts list\t: show all commands \nopscripts update\t: update opscripts \nopscripts command\t: execute a command\nopscripts uninstall\t: uninstall opscripts"
exit
fi
if [ "$1" = "list" ];then
list_command "$@"
fi
bin_dir=$OPSCRIPTS_DIR/bin/
java_bin_dir=$OPSCRIPTS_DIR/java/bin/
command_file=$1;shift
command=`find $bin_dir -maxdepth 1 -name $command_file `
if [ ! -f "$command" ]; then
command=`find $java_bin_dir -maxdepth 1 -name $command_file `
if [ ! -f "$command" ]; then
echo "$command_file command not found!"
exit 1;
fi
fi
exec "$command" "$@"