On Mon, May 01, 2017 at 11:24:44PM -0500, Eduardo Bustamante wrote: > > For the behavior you want, you need something like: > > > > test ! -h "$pathname" -a -f "$pathname"
Don't use that. test ! -h "$pathname" && test -f "$pathname" would be safe. Your test command has 6 arguments, for which "the results are unspecified". http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html Also, personally I prefer -L over -h, because -L is easier to remember. But there are older systems where -h is documented but -L is not, so you're not wrong there. (HP-UX 10.20's test(1) documents -h and not -L, but they both work. I suppose there are actually some systems where -L doesn't work, but I don't have access to any.)