Here's one of my routines that I'm rather fond of having written.
$sl is the save directory that the user is asked to enter. If the user enters a directory name that doesn't exist, the routine below will ask to create it. If the use user responds no, the download directory will default to $HOME/Videos/
if [ -n "$sl" ] ; then
if [[ ! -d "$vdir"/"$sl" ]]; then
printf "\n\33[1;34m$sl\33[0m does not exist.\n"
read -p "Create it? " yn
if [ $yn = y ] ; then
mkdir $HOME/Videos/"$sl"
vdir=$HOME/Videos/"$sl"
fi
else
vdir=$HOME/Videos/"$sl"
printf "\nSaving $aud1 to $vdir\n"
fi
else
printf "\nSaving $aud1 to $vdir\n"
fi
$aud1 is a filename


- solidarity with :streik:
