[ -w /etc/udev/rules.d ] returns FALSE in BASH for a RO root
[ -w /etc/udev/rules.d ] returns TRUE in DASH for a RO root
/usr/bin/[ -w /etc/udev/rules.d ] returns FALSE in BASH and DASH (and I assume every other shell) for a RO root
I had thought that POSIX specified that -w should return FALSE when used on a read-only filesystem, but perhaps I was incorrect.
A kludge would be to try and touch a file in /etc/udev/rules.d (errors to /dev/null), and then check the return code.
[ -w /etc/udev/rules.d ] returns FALSE in BASH for a RO root
[ -w /etc/udev/rules.d ] returns TRUE in DASH for a RO root
/usr/bin/[ -w /etc/udev/rules.d ] returns FALSE in BASH and DASH (and I assume every other shell) for a RO root
I had thought that POSIX specified that -w should return FALSE when used on a read-only filesystem, but perhaps I was incorrect.
A kludge would be to try and touch a file in /etc/udev/rules.d (errors to /dev/null), and then check the return code.