ヤードと可変パラメータ空間の問題

ヤードと可変パラメータ空間の問題

私のコードは次の目的で動作します。

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 \
)

最後のコードを実行した場合(ボタンを無視): ここに画像の説明を入力してください。

ただし、設定はまったく同じですが、3つの列があるため失敗します。実行してみると、同じ記号があっても'空白で区切られていることがわかります。

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' \
)

最後のコードを実行すると: ここに画像の説明を入力してください。

ベストアンサー1

おすすめ記事