Checklist and Dialog with external file - Shell Script

3

I need to use Dialog doing a Checklist from an external file, so far I've done the following:

dialog --stdout --checklist "Contas de e-mail: " 0 0 0 \
while read line
do
$line "" on \
done < contasemail.txt

But I'm getting the following error message, I'm hoping to have the checklist information

    
asked by anonymous 26.09.2017 / 15:57

1 answer

2

contasemail.txt :

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

checklist.sh :

#!/bin/bash

filename="$1"
tags=()

while read -r tag;
do
    tags+=("${tag} off")
done < "$filename"

emails=$(dialog --stdout --no-items --checklist "Contas de e-mail:" 20 50 ${#tags[@]} ${tags[@]})

Test:

$ ./checklist.sh contasemail.txt

Output:

    
05.10.2017 / 01:14