in reply to Re^2: Parsing a command-line string into an array
in thread Parsing a command-line string into an array

The down side is that
-x '1 2 3' -y 4 5

would have to be passed as

--extra-ffmpeg-param='-x '\''1 2 3'\'' -y 4 5'

You'd need nested quoting, which is very tricky.

This can probably be mitigated by mixing quotes.

--extra-ffmpeg-param='-x "1 2 3" -y 4 5'

And this isn't just tricky to build manually; this is also tricky to build programmatically from the shell. Like, what if you wanted to wanted to do the equivalent of ffmpeg -x "$x"? It would look something like

# to_shell_lit() - Creates a shell literal # Usage: printf '%s\n' "$( to_shell_lit "..." "..." "..." )" to_shell_lit() { local prefix='' local p for p in "$@" ; do printf "$prefix"\' printf %s "$p" | sed "s/'/'\\\\''/g" printf \' prefix=' ' done } --extra-ffmpeg-param="$( to_shell_lit -x "$x" )"

(Source)

This is part of the reason I suggested using multiple args.

-X '-x 1 2 3' -X '-y 4'
-X "-x $x" -X '-y 4'
or
-X 'x=1 2 3' -X 'y=4'
-X "x=$x" -X 'y=4'