Difference between 'if -e' and 'if -f'
bash, if-statement
Solution
See: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
I believe those aren't "if switches", rather "test switches" (because you have to use them inside [] brackets.
But the difference is:
`[ -e FILE ]` True if FILE exists.
This will return true for both `/etc/hosts` and `/dev/null` and for directories.
`[ -f FILE ]` True if FILE exists and is a regular file. This will return true for `/etc/hosts` and false for `/dev/null` (because it is not a regular file), and false for `/dev` since it is a directory.
Problem
There are two switches for the `if` condition which check for a file: `-e` and `-f`. What is the difference between those two?