1.

How To Test Files In A Shell Script?

Answer»

TEST command is used to perform different test on the files. Basic test are LISTED below:

Test: Usage

  • -d file_name: RETURNS true if the file exists and is a directory.
  • -e file_name: Returns true if the file exists.
  • -f file_name: Returns true if the file exists and is a regular file.
  • -r file_name: Returns true if the file exists and have read PERMISSIONS.
  • -s file_name: Returns true if the file exists and is not empty.
  • -w file_name: Returns true if the file exists and have write permissions.
  • -x file_name: Returns true if the file exists and have execute permissions.

Test command is used to perform different test on the files. Basic test are listed below:

Test: Usage



Discussion

No Comment Found