Adding basic script structure

This commit is contained in:
2020-03-28 20:18:41 +01:00
parent 1379a10dfd
commit 67b5efc78b
2 changed files with 24 additions and 9 deletions

27
xabs.sh
View File

@@ -3,28 +3,37 @@
# License: MIT
#
## OPTIONS ##
usage() { printf "helping" && exit 1; }
while getopts "nh" o; do case "${o}" in
h) printf "help" && exit ;;
while getopts "nt" o; do case "${o}" in
n) printf "user requested" && exit;;
t) testmode= $true;;
#*) printf "invalid option -%s\\n" "$OPTARG" && exit ;;
*) usage;;
esac done
## FUNCTIONS ##
installpkg(){
pacman --noconfirm --needed -S "$1" >/dev/null 2>&1 ;
}
welcomemsg(){
msg = "this is a test!"
dialog --title "Aloha!" --msgbox "hola" 10 60
if ["$testmode" = $true ];
then
echo "Installing" "$1"
else
echo "No test"
# pacman --noconfirm --needed -S "$1" >/dev/null 2>&1 ;
fi
}
# WTF is this line for??
grepseq="\"^[PGA]*,\""
#error() {clear; printf "ERROR: \\n%s\\n" "$1"; exit;}
welcomemsg(){
dialog --title "Aloha!" --msgbox "hola" 10 60
}
## SCRIPT START ##
installpkg dialog || error "Are you root and have an active internet connection?"
# Welcome everyone!
welcomemsg || error "Exited"
#welcomemsg || error "Exited"