mysql의 대화 상자 목록

mysql의 대화 상자 목록

mysql에 할 일 목록이 있습니다. 좀 더 대화식으로 만들기 위해 사용하고 싶습니다 dialog.

#!/bin/bash

mapfile -t todo < <(mysql -uroot -hmy_host -p$my_pass -Dmy_db -BNe "select task from todo where complete=0;")

list=$(printf "'%s' off " "${todo[@]}")

echo "$list"원하는 결과를 얻으면 :

'test' off 'test two' off 'another test job' off

수동으로 삽입하면 예상대로 작동합니다.

그러나 변수에서 대화 상자를 실행하면 공백이 매개변수를 'test two'발생시키고 'another test job'다음과 같은 결과를 얻습니다.

dialog --clear --no-items --checklist "todo list" 20 65 15 $(echo "$list")

Expected 2 arguments, found extra 1.

대화 상자의 확인란을 올바르게 채우기 위해 bash 스크립트에서 값을 어떻게 얻습니까?

나는 또한 이 답변의 코드를 시도했습니다. https://stackoverflow.com/questions/37631873/how-to-generate-interactive-dialog-checklist-from-command-output

이와 같이:

mapfile -t todo < <(mysql -uroot -hmy_host -p$my_pass -Dmy_db -BNe "select task from todo where complete=0;")

list=$(printf "'%s' off " "${todo[@]}")

cmd=$(dialog --stdout --no-items --separate-output --checklist "todo list" 20 65 15)

checklist=$("${cmd[@]}" "${list}")

하지만 이 오류가 발생합니다. 그리고 이것이 무엇을 의미하는지 모르겠습니다.

Expected at least 20 tokens for --chec, have 4.
Use --help to list options.

./test.sh: line 13: : command not found   #this is from checklist=$("${cmd[@]}" "${list}")

나는 mysql에서 대화 상자를 만드는 것이 매우 일반적인 작업이라고 생각했지만 주제에 대한 질문이나 답변을 찾지 못했습니다. 포기하고 PHP와 브라우저를 사용해야 할까요?

관련 정보