Answers for "check if file exist with find function in unix"

21

how check is file exist linux

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
2

linux test if string exists in file

if grep -Fxq "string" file.txt; then 
	echo "Match"
else 
	echo "No match"
fi
Posted by: Guest on January-28-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language