Date: Mon, 14 Aug 2017 10:50:01 -0400 From: "Ian D. Leroux" <idler...@fastmail.fm> Message-ID: <1502722201.165795.1072902592.394c1...@webmail.messagingengine.com>
| > I am not sure if it is a good idea to change the output in the default | > case. Perhaps we should add a flag to make the behavior explicit. A common flag used in several other places for this is -p (portable output). | > But | > at that point (if we add a flag), we might as well make the new output | > convenient to parse. Yes. | Any preferences for a conveniently-parseable format? I'd prefer to omit sh commands that will cause the mount to be performed, so that the filesystem returns to its current state. | That would look like: | | '/dev/wd0a' '/' ffs synchronous local | 'tmpfs' '/var/shm' tmpfs nosuid local | | That's directly parseable in shell How? What sh code would you use to read that and make it useful, and don't forget the case where the device or mount point contains a ' or a newline char. I'd prefer mount -t ffs -o synch,local $'/dev/wd0a' $'/' (where the quoting can be omitted when, as here, it is not needed), but this would require $'' support in sh first (we want that rather than just '' quoting so weird chars, like newlines and single quotes, can be included without making life difficult). If that is seen is useful, I can bump $'' support up the priority list (aside from its effects on $LINENO in some weird cases, implementing it is trivial, as FreeBSD have it already...) Then if you want to perform the mount, you just run that line as a sh script. On the other hand, if you want to find what is mounted where, you first just define mount() { shift $(($# - 2 )) DEVICE="$1" MOUNTPOINT="$2" } and then run the command, which will (if I did the arithmetic correctly, this is untested) result in setting DEVICE and MOUNTPOINT to the relevant strings). If you want other info as well, that function can just ba made more complex. (then you can unset -f mount if you need to later do real mount commands). kre