Bash Scripting - File Operations in Scripts
What will this script print if
mydir is a directory?if [ -f mydir ]; then echo "File"; else echo "Not a file"; fi
mydir is a directory?if [ -f mydir ]; then echo "File"; else echo "Not a file"; fi
-f operator returns true only if the path is a regular file.mydir is a directory, -f mydir returns false, so else branch runs.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions