estoy haciendo un pequeño Script en el cual estoy añadiendo el titulo de películas y exportándolo a un mismo archivo .txt.
Quiero controlar con un if y grep que si existe la misma palabra en el documento no añada el título al archivo. Pero me está dando problemas os dejo mi código:
function Add () {
read -p "TÍULO: " title
read -p "AÑO: " year
read -p "DIRECTOR: " director
read -p "PRODUCTORA: " prod
if [ grep -iq "${title}" bbdd_vc.txt ]; then
echo "La pelicula ya existe en la base de datos."
else
printf "TÍTULO: "${title}" \nAÑO: "${year}" \nDIRECTOR: "${director}" \nPRODUCTORA: "${prod}" \n\n" >> bbdd_vc.txt
echo ""
echo "$(tput setaf 2)"Añadido con éxito."$(tput sgr0)"
echo ""
fi
cat bbdd_vc.txt
MENU
Si alguien me puede decir en que estoy fallando, me estoy iniciando en Linux. Muchas gracias.