Am 27.02.22 um 04:33 schrieb Robert Nichols:
Does anything for CentOS 8 provide the function of the fstab-decode
utility?
Entries in /proc/mounts and /etc/fstab can have escape sequences for
certain special characters, and I need to decode that.
Preface: Never heard of fstab-decode before. Researching the command
made me really wonder why it was invented. Especially since I have never
seen an /etc/fstab with "escape sequences" or "special characters" since
at least 1990 (If I am wrong: Please show me such a fstab file).
So why not just use:
umount $(awk '$3 == "vfat" {print $2}' /etc/fstab)
instead of the seemingly canonical use of fstab-decode
fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab)
Myself, I would use the super-standard xargs, that can even take care of
the case that there might be no matching lines, that is:
awk '$3 == "vfat" {print $2}' /etc/fstab | xargs -r umount
And if there REALLY are files around with "special characters" I would
do it like this:
awk '$3 == "vfat" {ORS="\0" ; print $2}' /etc/fstab | xargs -0 -r
umount
I consider this a standard idiom usable for many more use cases than
just parsing /etc/fstab....
Peter
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos