Adding basic script structure
This commit is contained in:
27
xabs.sh
27
xabs.sh
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user