This is what I have been trying and it is unsuccessful. If I wanted to check if a file exists in the ~/.example directory
FILE=$1
if [ -e $FILE ~/.example ]; then
echo "File exists"
else
echo "File does not exist"
fi
You can use $FILE
to concatenate with the directory to make the full path as below.
FILE="$1"
if [ -e ~/.myexample/"$FILE" ]; then
echo "File exists"
else
echo "File does not exist"
fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With