zsh check if file exists code example
Example 1: zsh check if file exists
if [ ! -f /tmp/foo.txt ]; then
echo "File not found!" >&2
exit 1
fi
Example 2: zsh check if file exists
FILE=/etc/resolv.conf
if [[ -f "$FILE" ]]; then
echo "$FILE exists."
fi