Hello i am currently trying to make an if statement within shell script to detect if the user has no inputted any text.
i would like if the user hasnt entered anythign or if what they entered is invalid to echo and alert until they type in something correct.
here is what i have so far
echo "Current Address books "
ls -R |grep .txt
echo "--------------------------------------------------------------------"
echo -n "Please Enter the file you want to search in: "
read fileName
book=$fileName
if [ $fileName == "" ]
then
echo "Please Enter some Text "
else
echo -n "Please Enter a name: "
read search
grep -i $search $fileName
if grep -q "$search" "$fileName";
then
echo "Found!"
else
echo "Not Found!"
fi
fi