0

I try to make a dialog checklist in a bash script. I have to generate options from lines of a file. I think the problem is that my entries contains spaces and so, one entry is considered by many.

Dialog give me this error:

Error: Expected 3 arguments, found only 1. Use --help to list options.

Here my code:

while read entry; do
    option+=(0 "$entry" "off")
    echo "$option"
done < "$tempfilelist"

dialog --backtitle "Myscript"  \
       --title "Mytitle" \
       --checklist "Mytext" 10 70 4 "${option[@]}"

I even tried to put quotes in my loop, like this:

"'$entry'"

but no change.

and here's my file (tempfilelist):

Wed Apr 24 14:17:20 2013 20130423.maya.txt
Wed Apr 24 14:17:41 2013 maya.txt

How to get this script working?

Thanks !

4

1 回答 1

1

您的脚本不是由运行的bash;它正在运行dash。将脚本的第一行从

#!/bin/sh

#!/bin/bash
于 2013-04-25T13:18:44.760 回答