Never noticed so many replies. Here is what I ended up with including sample. For the fun of it I tried making a single master script for all my machines in one. So much for the "do one thing and do it well" philosphy. 775 lines. Relevant part below. Everything is wrapped in a function with case statements inside as needed.
Code:
SCRIPTCALL=$(basename "$0")
SCRIPTEXELINKS=/usr/local/bin
bin_link_create() { # creates symlinks necessary for script to function
if [[ ! -L "$SCRIPTEXELINKS"/"$1" ]] ; then
if [[ ! -d "$SCRIPTEXELINKS" ]] ; then
mkdir -p "$SCRIPTEXELINKS"
fi
if dir | grep $(basename "$0") > /dev/null ; then
ln -s $(pwd)/$(basename "$0") "$SCRIPTEXELINKS"/"$1"
else
ln -s "$0" "$SCRIPTEXELINKS"/"$1"
fi
fi
}
case "$SCRIPTCALL" in
# minecraft servers
stop|restart|backup|start|runtest) #MAINCOMMAND#
minecraft_controller "$SCRIPTCALL" "$@"
;;
kodistop|kodinewusr|kodiplaylists|kodimedia|kodistart) #MAINCOMMAND#
kodi_controller "$SCRIPTCALL"
;;
poweroff|reboot|pxewake) #MAINCOMMAND#
power_manager "$SCRIPTCALL" "$@"
;;
mysqlbackup) #MAINCOMMAND#
mysql_backup "$1" "$2"
;;
repowatch) #MAINCOMMAND#
repo_watcher
;;
dnscheck|servicecheck|status) #MAINCOMMAND#
services_manager "$SCRIPTCALL" "$@"
;;
upgrade|full-upgrade) #MAINCOMMAND#
package_upgrades "$SCRIPTCALL" "$1"
;;
mergerfspool|smartstatus) #MAINCOMMAND#
storage_manager "$SCRIPTCALL" "$@"
;;
mcramdisk|userload) #MAINCOMMAND#
minecraft_ramdisk "$SCRIPTCALL"
;;
touchpad) #MAINCOMMAND#
touchpad_toggle
;;
mute|raise|lower) #MAINCOMMAND#
volume_control "$SCRIPTCALL"
;;
servercheck) #MAINCOMMAND#
server__check
;;
dvdrip) #MAINCOMMAND#
dvd_ripper "$1"
;;
battery) #MAINCOMMAND#
battery_warning
;;
*)
if [[ "$USER" == root ]] ; then
for line in $(grep "#MAINCOMMAND#" "$0" | grep -v command | sed 's/#MAINCOMMAND#//g') ; do
if echo "$line" | grep "|" > /dev/null ; then
for command in $(echo "$line" | awk -F\| '{OFS="\n"; print $1, $2, $3, $4, $5, $6, $7, $8}' | cut -d\) -f 1) ; do
bin_link_create "$command"
done
else
for command in $(echo "$line" | cut -d\) -f 1) ; do
bin_link_create "$command"
done
fi
done
fi
;;
esac
Very hacky. Not sure who Rube Goldberg is but I get an idea from the statement. It works though.