I found this bash script (which works). This script plays an important role. The whole code quality of the script is good. I'm just wondering if there's any sense at the following construction?
if [ "${G_FILE}" != "" ] && [ -f "${G_FILE}" ] && [ -r "${G_FILE}" ]; then
....
The manual says:
[ -f FILE ] True if FILE exists and is a regular file.
[ -r FILE ] True if FILE exists and is readable.
[ STRING1 != STRING2 ] True if the strings are not equal.
My thoughts:
[ -n "${G_FILE}" ]or[ "${G_FILE}" ]should be instead of[ "${G_FILE}" != "" ].- Only
[ -r "${G_FILE}" ]will do the same.
Am I right?