Home

fstab-decode(8)

FSTAB-DECODE(8)Linux System Administrator's ManualFSTAB-DECODE(8)

fstab-decode - run a command with fstab-encoded arguments

fstab-decode COMMAND [ARGUMENT ...]

fstab-decode decodes escapes (such as newline characters and other whitespace) in the specified ARGUMENTs and uses them to run COMMAND. The argument escaping uses the same rules as path escaping in /etc/fstab, /etc/mtab and /proc/mtab.

In essence fstab-decode can be used anytime we want to pass multiple parameters to a command as a list of command line arguments. It turns output like this:

/root/mnt/remote-disk/homeInto one long list of parameters, "/root /mnt/remote-disk /home". Thiscan be useful when trying to work with multiple filesystems at once. Forinstance, we can use it to unmount multiple NFS shares. This program alsoremoves whitespace and other characters which might cause programs suchas mount(8) or umount(8) to fail.

fstab-decode exits with status 127 if COMMAND can't be run. Otherwise it exits with the status returned by COMMAND.

The following example reads fstab, finds all instances of VFAT filesystems and prints their mount points (argument 2 in the fstab file). fstab-decode then runs the specified program, umount(8), and passes it the list of VFAT mountpoints. This unmounts all VFAT partitions.

fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab)

fstab(5)

May 2006sysvinit