From 9a24aee7fa841f28008ea6c85d24a8b7280f563e Mon Sep 17 00:00:00 2001 From: mollusk Date: Wed, 6 Jul 2016 13:52:27 -0700 Subject: [PATCH] [Updated] idd.sh: Added Quit option --- idd.sh | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/idd.sh b/idd.sh index 8801610..44d5aa8 100755 --- a/idd.sh +++ b/idd.sh @@ -17,6 +17,7 @@ CYAN="\033[0;36m" LCYAN="\033[1;36m" PURPLE="\033[0;35m" LPURPLE="\033[1;35m" +BWHITE="\e[1m" NC='\033[0m' # No Color if [[ $EUID -ne 0 ]]; then @@ -24,13 +25,32 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi +Options(){ + + printf "${BWHITE}[Q]${NC} - Quit\n" +} + +Quit(){ + if [ "${1}" = "q" ];then + echo + printf "${LRED}Exiting......${NC}\n" + echo + exit 0; + elif [ "${1}" = "Q" ];then + echo + printf "${LRED}Exiting......${NC}\n" + echo + exit 0; + fi +} + case "$1" in -d) if [ -f /usr/bin/pv ];then clear - printf "${LCYAN}idd - interactive dd${NC}\n" printf "${LPURPLE}********************************${NC}\n" + Options echo printf "${LGREEN}Image files (img, iso) in ${2}${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n" @@ -43,8 +63,10 @@ case "$1" in printf "${YELLOW}Copy & paste full file path here: ${NC}" read filepath - + Quit ${filepath} clear + Options + echo printf "${LGREEN}List of DEVICES in ${DEVICEDIR}/${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n" lsblk @@ -52,6 +74,7 @@ case "$1" in echo printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): " read devname + Quit ${devname} echo @@ -70,9 +93,9 @@ case "$1" in ;; *) if [ -f /usr/bin/pv ];then clear - printf "${LCYAN}idd - interactive dd${NC}\n" printf "${LPURPLE}********************************${NC}\n" + Options echo printf "${LGREEN}Image files (img, iso) in ${HOMEDIR}${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n" @@ -87,7 +110,11 @@ case "$1" in printf "${YELLOW}Copy & paste full file path here: ${NC}" read filepath + Quit ${filepath} + clear + Options + echo printf "${LGREEN}List of DEVICES in ${DEVICEDIR}/${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n" lsblk @@ -95,6 +122,7 @@ case "$1" in echo printf "${YELLOW}Enter name of device${NC} (${LCYAN}example${NC}, ${LBLUE}sdb${NC}): " read devname + Quit ${devname} echo