0

When I try to check for a file in a folder using if elif its not entering the loop correctly

if [ -e "~/file" ]; then 
   echo "abc"
elif   [ -f "$DIR/file" ]; then
  echo "bbbc"

else 
    echo "both the files does not exists - throwing error"
fi

There is a file "~/file" and it bluntly goes inside both if and elif and returns saying echo "both the files does not exists - throwing error"

But when I try negate operation it enters and checks for the file

if [ ! -e "~/file" ]; then

0 Answers0