我的代码适用于:
binariesPathList="FALSE 'inkscape'
TRUE '/home/jeanfar/Downloads/binary-portable/inkscape/Inkscape-1.0-4035a4f-x86_64.AppImage'
FALSE '/home/jeanfar/Downloads/binary-portable/inkscape/Inkscape-f54ab5f-x86_64.AppImage'
FALSE '/home/jeanfar/git-clones/inkscape-0.92.5/build/install_dir/bin/inkscape'
FALSE '/home/jeanfar/git-clones/inkscape/build/install_dir/bin/inkscape'"
# This is to demonstrate how YAD will receive it.
echo $binariesPathList
answer=$(yad \
--list \
--radiolist \
--column="Pick" \
--column="Application" \
--column="Application Path" \
$binariesPathList \
)
但由于配置完全相同,但三列而失败。如果你运行它,你会注意到即使有相同的'
符号,它也会被空格分开。
binariesPathList="FALSE 'System Default Installation' 'inkscape'
TRUE '1.0 AppImage' '/home/jeanfar/Downloads/binary-portable/inkscape/Inkscape-1.0-4035a4f-x86_64.AppImage'
FALSE '1.1-dev Appimage' '/home/jeanfar/Downloads/binary-portable/inkscape/Inkscape-f54ab5f-x86_64.AppImage'
FALSE '0.92.5 Build' '/home/jeanfar/git-clones/inkscape-0.92.5/build/install_dir/bin/inkscape'
FALSE 'Master Build' '/home/jeanfar/git-clones/inkscape/build/install_dir/bin/inkscape'"
# This is to demonstrate how YAD will receive it.
echo $binariesPathList
answer=$(yad \
--list \
--radiolist \
--column="Pick" \
--column="Application" \
--column="Application Path" \
$binariesPathList \
)
这里真正奇怪的是,您可以将参数直接放在变量应该在的位置,并且它会比第一个更好地工作,即使有那些空格。
它与 echo 的复制粘贴完全相同,但如果用$(echo $binariesPathList)
它替换变量将得到相同的结果。
answer=$(yad \
--list \
--radiolist \
--column="Pick" \
--column="Application" \
--column="Application Path" \
FALSE 'System Default Installation' 'inkscape' FALSE '1.0 AppImage' '/home/jeanfar/Downloads/binary-portable/inkscape/Inkscape-1.0-4035a4f-x86_64.AppImage' FALSE '1.1-dev Appimage' '/home/jeanfar/Downloads/binary-portable/inkscape/Inkscape-f54ab5f-x86_64.AppImage' FALSE '0.92.5 Build' '/home/jeanfar/git-clones/inkscape-0.92.5/build/install_dir/bin/inkscape' FALSE 'Master Build' '/home/jeanfar/git-clones/inkscape/build/install_dir/bin/inkscape' \
)