My code works with:
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
)
If you run that last code (Ignore buttons):
But fails with the exact same configuration, but three columns.
If you run it, you will note that even with the same '
sign, it split by spaces.
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
)
If you run that last code (Ignore buttons):
The really strange thing here is that you can put the parameters directly where the variable should be, and it will work even better than first, and even with those spaces.
It's exactly as a copy-paste of the echo, but if you replace the variable with $(echo $binariesPathList)
it will be the same result.
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' \
)
yad
code a string and useeval "...
, because then the$binariesPathList
variable will be substituted before they passed toyad
. Just like copy-paste theecho
. But this is not a really practical solution for every time I have this issue. – DATALOT Jun 21 '20 at 08:05eval
), because the arguments I'm trying to passe are in a string that the user put trough a text input in yad. That input is converted to a variable, and that variable is what I need to use. – DATALOT Jun 21 '20 at 18:38eval
or something else that knows how to parse shell syntax – ilkkachu Jun 21 '20 at 18:45binariesPathList="$(printf "%s" "$binariesPathList" | xargs -n 1 printf "%s\n")"
and then
– Miloš Pavlović Jul 21 '20 at 03:42yad --list --radiolist --column="Pick" --column="Application" --column="Application Path" <<<"${binariesPathList}"