Demasiados argumentos error en bash
Estoy escribiendo un script para borrar todos los archivos en un directorio para practicar. Estoy usando comillas alrededor de mis variables y, sin embargo, sigo recibiendo el siguiente error:
/usr/local/bin/deleteall: line 6: [: too many arguments
/usr/local/bin/deleteall: line 11: [: too many arguments
Aquí está mi código:
#!/bin/bash
#Deletes all files in the current directory
read -p "You are about to delete all files in $(pwd). Are you sure you want to do this? y/n" yn
echo $yn
if [ [ "$yn" = "y" ] -o [ "$yn" = "Y" ] ] ; then
for i in `ls`; do
rm $i
done
exit;
elif [ [ "$yn" = "n" ] -o [ "$yn" = "N" ] ] ; then
exit;
else
read -p "Please enter y (yes) or n (no)"
exit;
fi
Y esta es toda la salida:
You are about to delete all files in <my dir>. Are you sure you want to do this? y/nn
n
/usr/local/bin/deleteall: line 6: [: too many arguments
/usr/local/bin/deleteall: line 11: [: too many arguments
Please enter y (yes) or n (no)n
¿Qué estoy haciendo mal?