Bashからダイアログボックスの値を出力できません。

Bashからダイアログボックスの値を出力できません。

ダイアログボックスにダイナミックメニューがありますが(アイテムは配列で提供されます)、メニューに選択したオプションは表示されません。

gp_options=()
for i in `find ~ -type d -name .git`; do
    gp_options+=("" "$i")
done

gp_dialog=(dialog --stdout --extra-button --help-button \
--ok-label 'Access repository' \
--extra-label 'Create repository' \
--cancel-label 'Remove repository'
--help-label 'Cancel' \
--backtitle "Welcome to Git Bash `whoami`!" \
--title ' Manage repositories ' \
--menu 'Manage repositories' \
0 0 0 \
"${gp_options[@]}")

dialog --stdout --msgbox "$manage_repositories" 0 0

ベストアンサー1

数時間の研究の終わりに、ついに答えを見つけました。

repositorios=() ; i=0
while read -r line; do
    let i=$i+1
    repositorios+=($i "$line")
done < <( find ~ -type d -name .git )

gerenciar_repositorios=$(dialog --stdout --extra-button --help-button \
--ok-label "Acessar repositório" \
--extra-label 'Criar repositório' \
--cancel-label 'Remover repositório' \
--help-label 'Cancelar' \
--backtitle "Bem vindo ao Git Bash `whoami`!" \
--title ' Gerenciar repositórios ' \
--menu 'Gerenciar repositórios' 0 0 0 \
${repositorios[@]})

おすすめ記事