Conditional Expressions Flashcards
Learn the different conditional expressions of the Bourne Again (bash) shell
What is the result of this test? -a file
True if file exists
What is the result of this test? -b file
True if file exists and is a block special file.
What is the result of this test? -c file
True if file exists and is a character special file.
What is the result of this test? -d file
True if file exists and is a directory.
What is the result of this test? -e file
True if file exists.
What is the result of this test? -f file
True if file exists and is a regular file.
What is the result of this test? -g file
True if file exists and is set-group-id.
What is the result of this test? -h file
True if file exists and is a symbolic link.
What is the result of this test? -k file
True if file exists and its ``sticky’’ bit is set.
What is the result of this test? -p file
True if file exists and is a named pipe (FIFO).
What is the result of this test? -r file
True if file exists and is readable.
What is the result of this test? -s file
True if file exists and has a size greater than zero.
What is the result of this test? -t fd
True if file descriptor fd is open and refers to a terminal.
What is the result of this test? -u file
True if file exists and its set-user-id bit is set.
What is the result of this test? -w file
True if file exists and is writable.