mirror of
https://github.com/skiqqy/skiqqy.github.io
synced 2024-12-24 16:02:06 +00:00
35 lines
534 B
Bash
Executable File
35 lines
534 B
Bash
Executable File
#!/bin/bash
|
|
# @Auther skiqqy
|
|
# This script allows me to enable/disable certain sections of my website.
|
|
|
|
help_menu () {
|
|
echo "Welcome!"
|
|
echo -e "e\t->\tEnable a unit."
|
|
echo -e "d\t->\tDisable a unit."
|
|
echo -e "h\t->\tShows this message."
|
|
}
|
|
|
|
error () {
|
|
echo "[ERROR] $1"
|
|
exit $2
|
|
}
|
|
|
|
while getopts "he:d:" opt
|
|
do
|
|
case $opt in
|
|
h)
|
|
help_menu
|
|
;;
|
|
e | d)
|
|
[ ! -z $unit ] && error "Unit <$unit> already set" 1
|
|
[[ $opt == "e" ]] && oper=e || oper=d
|
|
unit="$OPTARG"
|
|
;;
|
|
*)
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo $unit, $oper
|