[Updated] idd.sh: Moved find command to it's own function

This commit is contained in:
mollusk 2016-07-10 10:21:09 -07:00
parent 522522bf90
commit 6fbb12759c

17
idd.sh
View File

@ -29,7 +29,17 @@ Options(){
printf "${BWHITE}[Q]${NC} - Quit\n" 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(){ CheckFile(){
if [ ! -f "${1}" ];then if [ ! -f "${1}" ];then
printf "${LRED}${1} is not a valid file path${NC}\n" 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 "${LGREEN}Image files (img, iso) in ${2}${NC}\n"
printf "${LBLUE}-------------------------------------------${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 if [ ! $? = 0 ];then
printf "${LRED}No image files found${NC}\n" printf "${LRED}No image files found${NC}\n"
fi fi
@ -135,7 +146,7 @@ case "$1" in
printf "${LGREEN}Image files (img, iso) in ${HOMEDIR}${NC}\n" printf "${LGREEN}Image files (img, iso) in ${HOMEDIR}${NC}\n"
printf "${LBLUE}-------------------------------------------${NC}\n" printf "${LBLUE}-------------------------------------------${NC}\n"
find ${HOMEDIR} -regex ".*\.\(img\|iso\)" | grep [.iso,.img] FindImages
if [ ! $? = 0 ];then if [ ! $? = 0 ];then
printf "${LRED}No image files found${NC}\n" printf "${LRED}No image files found${NC}\n"
fi fi