linux poison RSS
linux poison Email

Bash Script: File related operations

Following table describe the operation that you can perform on any given file.

[ -a FILE ]    True if FILE exists.
[ -b FILE ]    True if FILE exists and is a block-special file.
[ -c FILE ]    True if FILE exists and is a character-special file.
[ -d FILE ]    True if FILE exists and is a directory.
[ -e FILE ]    True if FILE exists.
[ -f FILE ]    True if FILE exists and is a regular file.
[ -g FILE ]    True if FILE exists and its SGID bit is set.
[ -h FILE ]    True if FILE exists and is a symbolic link.
[ -k FILE ]    True if FILE exists and its sticky bit is set.
[ -p FILE ]    True if FILE exists and is a named pipe (FIFO).
[ -r FILE ]    True if FILE exists and is readable.
[ -s FILE ]    True if FILE exists and has a size greater than zero.
[ -t FD ]        True if file descriptor FD is open and refers to a terminal.
[ -u FILE ]    True if FILE exists and its SUID (set user ID) bit is set.
[ -w FILE ]   True if FILE exists and is writable.
[ -x FILE ]    True if FILE exists and is executable.
[ -O FILE ]    True if FILE exists and is owned by the effective user ID.
[ -G FILE ]    True if FILE exists and is owned by the effective group ID.
[ -L FILE ]    True if FILE exists and is a symbolic link.
[ -N FILE ]    True if FILE exists and has been modified since it was last read.
[ -S FILE ]    True if FILE exists and is a socket.




0 comments:

Post a Comment

Related Posts with Thumbnails