I see I can do
$ [ -w /home/durrantm ] && echo "writable"
writable
or
$ test -w /home/durrantm && echo "writable"
writable
or
$ [[ -w /home/durrantm ]] && echo "writable"
writable
I like using the third syntax. Are they equivalent in all ways and for all negative and edge cases? Are there any differences in portability, e.g. between bash on Ubuntu and on OS X or older/newer bash versions, e.g. before/after 4.0 and do they both expand expressions the same way?
[ … ]
vs[[ … ]]
vstest …
, there are more complete answers in this mostly duplicate question.