I'm currently learning the basics of bash scripting (coming from a Pythonic background) and It seems I've run into an interesting situation in which I need a bit of explanation with.
My goal is to create a Path variable that contains a text file. I use an if-statement to check whether the file exists in the directory. If it exists, It will print "It exists".
Then I created a for-loop to print out the elements in the file list. When I execute the program, there is no output and no errors being thrown.
Any help or explanation would be much appreciated! Here is the code below:
#!/bin/bash
veggieFile=/home/lynova/Potato/hewwo.txt
if [ -e veggieFile ]; then
echo "File exists"
for VEGGIE in $(cat veggieFile ); do
echo "Veggies are ${VEGGIE}"
done
fi