On Sun, 20 Mar 2016 07:02:26 +0700 Robert Elz <kre%munnari.OZ.AU@localhost> wrote: > Date: Sat, 19 Mar 2016 21:37:03 +0100 > From: "Ian D. Leroux" <idleroux%fastmail.fm@localhost> > Message-ID: <20160319213703.0ed2bfa10139f9c700a4b161%fastmail.fm@localhost> > > | Surely there > | has to be a better, less brittle way of getting the required > | information. Can anyone give me a hint as to what it might be? > > try > eval set -- $( mount -t tmpfs | while read -r line; do > fs=${line#tmpfs on }; fs=${fs% type tmpfs*}; > echo "'${fs}'"; done ) > > after which "$@" should be the tmpfs moounted filesystems, even if > they contain odd characters (including spaces). Thanks for the example code, which helped me identify and clear up a bunch of my misconceptions about the Bourne shell's parsing behaviour. The latest set of patches are attached. This version uses no magic values: $swapoff_umount is used to choose between auto or manual selection of the filesystems to unmount, and $swapoff_umount_fs is used for the list of mount points when manually specified. I've tested that the auto-selection is robust against spaces and tabs in filenames, and I expect it to handle odd characters other than single-quote. In the pathological case where a path to a tmpfs mount point contains a single-quote character, it could be specified manually with appropriate escaping. Further suggestions? -- IDL
Attachment:
manpage.patch
Description: Binary data
Attachment:
rc.conf.patch
Description: Binary data
Attachment:
swap1.patch
Description: Binary data