Re: Need fstab-decode for CentOS 8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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[@]}"

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux