In case of test -e for example:
VAR="<this is a file path: /path/to/file/or/dir" test -e $VAR && do_something || do_anotherthing Question: Should I use "$VAR" here?, here I don't like verbose if not necessary, because $VAR obviously in this case is a path then if it's empty string it should always fail because there's no path that is empty string, then with my logic, double quote it is not necessary.
But it case of string test, test -n for exmpale:
VAR="<this is a string" test -n $VAR && do_something || do_anotherthing then with my logic, $VAR should be put in double quote: "$VAR" because it can be expanded to an empty string that if not in double quote will be expanded to -n argument only and always true.
So the actual question because of that I'm in doubt of that should we only use double quotes in test command only with -n and -z against strings?
"$VAR"here?, here I don't like verbose if not necessary, because $VAR obviously in this case is a path then if it's empty string it should always fail because there's no path that is empty string, then with my logic, double quote it is not necessary." Can you please rephrase that, ideally with shorter sentences?