[CentOS] Need fstab-decode for CentOS 8

Tue Mar 1 16:52:49 UTC 2022
Gordon Messmer <gordon.messmer at gmail.com>

On 3/1/22 05:53, Robert Nichols wrote:
> It turns out that particular wheel is best resurrected from the 
> fstab-decode.c file in an old initscripts source package. The encoding 
> is nonstandard, and the above perl code would not handle it correctly.


It's pretty close.  It won't handle double backslash, and its use of 
xargs is incorrect.

If you prefer a version that you don't need a C compiler to use, here's 
a pure bash implementation:

#!/bin/sh

declare -a cmdline
eol=$'\n'

for arg in "$@"
do
   arg="${arg//\011/    }"
   arg="${arg//\012/$eol}"
   arg="${arg//\040/ }"
   arg="${arg//\134/\\}"
   arg="${arg//\\/\\}"
   cmdline+=("$arg")
done

"${cmdline[@]}"