Answers for "shell logical and for file existence"

7

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
0

shell logical and for file existence

if [[ -f $FILE1 ]] && [[ -f $FILE2 ]]; then
    echo "OK"
fi
Posted by: Guest on December-17-2020

Code answers related to "shell logical and for file existence"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language