hi I keep getting an error with this nested if statement and am getting the error unexpected end of file, can anyone help me as to why this wont execute?
#!/bin/bash
#script to check wether the -i -v statements run correctly
removeFile ()
{
mv $1 $HOME/deleted
}
#Function to imitate verbose
verbose ()
{
echo " removed $1 "
i_option=0
v_option=0
r_option=0
while getopts :ivrR option
do
case $option in
i) i_option=1 ;;
v) v_option=1 ;;
r|R) r_option=1 ;;
*) echo "invalid option" ;;
esac
shift $(( $OPTIND -1 ))
done
if [[ $i_option -eq 1 && $v_option -eq 1 && $r_option -eq 0 ]]
then
if [ -f $1 ]
then
if [ -s $1 ]
then
read -p "rm: remove regular file '$1'?" choice
if [[ $choice = Y || $choice = y ]]
then
removeFile $1
verbose $1
else
exit 1
fi
elif ! [ -s $1 ]
then
read -p "rm: remove regular empty file '$1'?" choice1
if ! [[ $choice1 = Y || $choice1 = y ]]
then
removeFile $1
verbose $1
else
exit 1
fi
fi
elif [ -d $1 ]
then
echo "rm: cannot remove '$1': Is a directoy"
else
echo "No such a file or directory"
fi
fi