Dears, i need to test an argument to check if it's a directory, normal file or other kinds of files as i know anything that is not a directory is a file so i can make a test like
br@IBMLC0B2ZJL:/mnt/d/a343$ [ -f gg.sh ] && echo "file"
br@IBMLC0B2ZJL:/mnt/d/a343$ [ -d folder ] && echo "directory"
but i just saw a question that requires to check the file if a normal file or not, is there any ideas to test that ??
The original question : "Write a shell script that accepts a file or directory name as an argument. Have the script report if it is a regular file, a directory, or other type of file. If it is a regular file, exit with a 0 exit status. If it is a directory, exit with a 1 exit status. If it is some other type of file, exit with a 2 exit status."
-falready tests. See gnu.org/software/bash/manual/html_node/… for tests for other types of files.