![]() ![]() the file exists but is not a regular file (could be a device, fifo, directory, socket.).However if it returns false (or if or ! return true), there are many different possibilities: So if returns true, you can tell the file does exist and is a regular file or a symlink eventually resolving to a regular file (or at least it was at the time of the stat()). The [ command does a stat() (not lstat()) system call on the path stored in $file and returns true if that system call succeeds and the type of the file as returned by stat() is " regular". x filename - Check if file is executableĪ test expression can be negated by using the ! operator #!/bin/bash u filename - Check if file set-user-id bit is set s filename - Check if file is nonzero size r filename - Check if file is a readable O filename - True if file exists and is owned by the effective user id G filename set-group-id - True if file exists and is set-group-id G filename - Check if file exists and is owned by effective group ID f filename - Check for regular file existence not a directory ![]() e filename - Check for file existence, regardless of type (node, directory, socket, etc.) ![]() d directoryname - Check for directory Existence ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |