Q: How do I access the individual 'mounts' database entries using niutil? Because of the slashes in the property values, niutil doesn't seem to understand the input.
A: Indeed, if you try something straightforward like:
niutil -read . /mounts//dev/sd0a
you get an error message such as
niutil: can't open .:/mounts//dev/rsd0a
because niutil is using / to separate properties. So, let's say we have the following:
and we want to execute niutil -read on the /dev/sd0a entry. We have to find some way to escape those slashes in the property value (``/dev/sd0a'') or we're sunk. The simple ways don't work:
% niutil -read . /mounts\/dev\/rsd0a
niutil: can't open .:/mounts/dev/rsd0a
% niutil -read . /mounts/'/dev/rsd0a'
niutil: can't open .:/mounts//dev/rsd0a
Turns out it's necessary to use a DOUBLE backslash to get the proper escaping:
Why? Because if one types simply '\/' the shell gobbles the escape character
(the \), and transform this into '/'. If one types TWO slashes, then the shell turns
them into one, and there is one in the string passed to niutil as its argument.