From 8f9fe993f52a4009dd21843279a9b821d0996ecc Mon Sep 17 00:00:00 2001 From: steveokard Date: Wed, 24 Aug 2022 21:37:27 -0400 Subject: [PATCH] output help if no parameters sent --- firefox.sh => scripts/firefox.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) rename firefox.sh => scripts/firefox.sh (95%) diff --git a/firefox.sh b/scripts/firefox.sh similarity index 95% rename from firefox.sh rename to scripts/firefox.sh index 94fb59c..9f906b1 100755 --- a/firefox.sh +++ b/scripts/firefox.sh @@ -1,4 +1,12 @@ #!/bin/bash +help() { + echo "Usage: $(basename $0) + [-e] Installs Firefox ESR + [-f] Installs Flatpak Firefox + [-r] Installs regular Firefox and Pins It's Priority + [-p] Purges the Snapd daemon from the system. Use if you don't want snaps anymore period." + exit 1 +} add_ppa() { sudo add-apt-repository ppa:mozillateam/ppa sudo apt update @@ -7,6 +15,8 @@ add_ppa() { echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox } +if [ -z "$*" ]; then help; fi + #process flags while getopts 'efrp:h' opt; do case "$opt" in @@ -40,13 +50,8 @@ Pin-Priority: 1001 sudo apt autoremove snapd ;; - ?|h) - echo "Usage: $(basename $0) - [-e] Installs Firefox ESR - [-f] Installs Flatpak Firefox - [-r] Installs regular Firefox and Pins It's Priority - [-p] Purges the Snapd daemon from the system. Use if you don't want snaps anymore period." - exit 1 + *) + help ;; esac done