.dotfiles/.local/bin/run

27 lines
554 B
Bash
Executable File

#!/bin/bash
script=""
args=""
run_as_sudo="false"
while getopts "s:r:a:l" opt; do
case $opt in
s) run_as_sudo="true" ;;
r) script="$OPTARG" ;;
a) args="$OPTARG" ;;
l)
printf "Available scripts:\n%s" "$(/bin/ls "$HOME/.dotfiles/scripts/")"
exit
;;
\?)
printf "Get good"
exit
;;
esac
done
if [ "$run_as_sudo" = "true" ]; then
sudo bash "$HOME/.dotfiles/scripts/$script" "$args"
else
bash "$HOME/.dotfiles/scripts/$script" "$args"
fi