Answers for "how to check if file exists in bash shell script"

12

check if file exists bash

FILE=/etc/resolv.conf
if [ -f "$FILE" ]; then
    echo "$FILE exists."
else 
    echo "$FILE does not exist."
fi
Posted by: Guest on October-23-2020
12

.sh script: check if file exist

#!/bin/bash
if [ -e x.txt ]
then
    echo "ok"
else
    echo "nok"
fi
Posted by: Guest on March-24-2020

Code answers related to "how to check if file exists in bash shell script"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language