bash: can't get out of SELECT
I am taking my first stab at writing a bash script. I am writing a script which will install all of the packages in chapter 5 of lfs. I am having problems geting out of the SELECT menue statements (or whatever you guys call them. I made a function called "decompress" which asks if you want your files decompressed, and does it if you do (then moves the orig. files into another folder). Anywase, I can't figure out how to get out of the SELECT statement..... no matter what option i choose, it still brings me back to the menue. I've also tried "exit" after the "if"'s, but that just puts me back to the command line. I have quite a few more functions that i would like to call after "decompress", can anybody help me out? here's decompress:
function decompress {
echo Do you need the files to be decompressed?
OPTIONS="Yes No"
select opt in $OPTIONS; do
if [ "$opt" = "Yes" ]; then
mkdir compressed
for i in $( ls | grep .tar.bz2 );
do
tar -jxvf $i
mv $i compressed/
done
for i in $( ls | grep .bz2 );
do
bunzip2 $i
done
for i in $( ls | grep .tar.gz)
do
tar -zxvf $i
mv $i compressed/
done
clear
echo "All files ending with '.tar.bz2' and '.tar.gz' have been decompressed"
echo " and placed into 'compressed/' folder"
echo
echo " files ending in '.patch.bz2' have been decompressed"
elif [ "$opt" = "No" ]; then
clear
echo MAKE SURE all of your source files are decompressed!!!
echo
echo
else
clear
echo BAD OPTION... Do you want your files decompressed?
fi
done
}
|