From 6fbb12759cc1e71535daf07eeb198572e3179013 Mon Sep 17 00:00:00 2001 From: mollusk Date: Sun, 10 Jul 2016 10:21:09 -0700 Subject: [PATCH] [Updated] idd.sh: Moved find command to it's own function --- idd.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/idd.sh b/idd.sh index ca154ed..213d295 100755 --- a/idd.sh +++ b/idd.sh @@ -29,7 +29,17 @@ Options(){ printf "${BWHITE}[Q]${NC} - Quit\n" } - +FindImages(){ + printf "${YELLOW}Searching for image files..${NC}\n" + echo + printf "${LCYAN}Results Found:${NC}\n" + echo + if [ "${1}" ];then + find $1 -regex ".*\.\(img\|iso\)" | grep [.iso,.img] + else + find ${HOMEDIR} -regex ".*\.\(img\|iso\)" | grep [.iso,.img] + fi +} CheckFile(){ if [ ! -f "${1}" ];then printf "${LRED}${1} is not a valid file path${NC}\n" @@ -87,7 +97,8 @@ case "$1" in printf "${LGREEN}Image files (img, iso) in ${2}${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n" - find $2 -regex ".*\.\(img\|iso\)" | grep [.iso,.img] + #find $2 -regex ".*\.\(img\|iso\)" | grep [.iso,.img] + FindImages $2 if [ ! $? = 0 ];then printf "${LRED}No image files found${NC}\n" fi @@ -135,7 +146,7 @@ case "$1" in printf "${LGREEN}Image files (img, iso) in ${HOMEDIR}${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n" - find ${HOMEDIR} -regex ".*\.\(img\|iso\)" | grep [.iso,.img] + FindImages if [ ! $? = 0 ];then printf "${LRED}No image files found${NC}\n" fi