shell file comparison

-d file check if file exists and is a directory
-e file check if file exists
-f file check if file exists and is a file
-r file check if file exists and is readable
-s file check if file exists and is not empty
-w file check if file exists and is writable
-x file check if file exists and is executable
-O file check if file exists and is owned by current user
-G file check if file exists and default group is same as current user
file1 -nt file2 check file1 is file1 newer than file2
-ot file2 check if file1 is older than file2

if [ -d /usr/local/shell/folder ]
then
  echo "it's a folder"
else
  echo "not a folder"
fi

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326944692&siteId=291194637