variable number of checkboxes in dialog

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am using Cdparanoia and Sox (play) to play CD's on an old Nokia internet tablet. I am using 'dialog' with the checklist option, to either select individual tracks or the entire disk for playback.
How can I adapt the script so that it can find out the number of tracks on the CD and so create a checkbox for each track (and name them track1, track2 etc)
I can find the number of tracks:
var=`cdparanoia -sQ |& cat | wc -l`; echo $[ $var - 8 ]
and the script that I am currently using is based on:
#!/bin/bash
mycmd=(dialog --separate-output --checklist "Select options:" 22 76 16)
options=(1 "Track 1" off # any option can be set to default to "on"
2 "Track 2" off
3 "Track 3" off
4 "All Tracks" off)
choices=$("$mycmd[@]" "$options[@]" 2>&1 >/dev/tty)
clear
for choice in $choices
do
case $choice in
1)
echo "Track1"
;;
2)
echo "track2"
;;
3)
echo "track3"
;;
4)
echo "All Tracks"
;;
esac
linux dialog
add a comment |Â
up vote
0
down vote
favorite
I am using Cdparanoia and Sox (play) to play CD's on an old Nokia internet tablet. I am using 'dialog' with the checklist option, to either select individual tracks or the entire disk for playback.
How can I adapt the script so that it can find out the number of tracks on the CD and so create a checkbox for each track (and name them track1, track2 etc)
I can find the number of tracks:
var=`cdparanoia -sQ |& cat | wc -l`; echo $[ $var - 8 ]
and the script that I am currently using is based on:
#!/bin/bash
mycmd=(dialog --separate-output --checklist "Select options:" 22 76 16)
options=(1 "Track 1" off # any option can be set to default to "on"
2 "Track 2" off
3 "Track 3" off
4 "All Tracks" off)
choices=$("$mycmd[@]" "$options[@]" 2>&1 >/dev/tty)
clear
for choice in $choices
do
case $choice in
1)
echo "Track1"
;;
2)
echo "track2"
;;
3)
echo "track3"
;;
4)
echo "All Tracks"
;;
esac
linux dialog
1
Actually that's not a checklist, but a menu (see the manual). As a start, you'd have to add a column to the array ofofftokens.
â Thomas Dickey
Oct 22 '17 at 23:41
Thanks, I've edited my post to show correct example code (It was late when I posted originally)
â Phil Turner
Oct 23 '17 at 7:26
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using Cdparanoia and Sox (play) to play CD's on an old Nokia internet tablet. I am using 'dialog' with the checklist option, to either select individual tracks or the entire disk for playback.
How can I adapt the script so that it can find out the number of tracks on the CD and so create a checkbox for each track (and name them track1, track2 etc)
I can find the number of tracks:
var=`cdparanoia -sQ |& cat | wc -l`; echo $[ $var - 8 ]
and the script that I am currently using is based on:
#!/bin/bash
mycmd=(dialog --separate-output --checklist "Select options:" 22 76 16)
options=(1 "Track 1" off # any option can be set to default to "on"
2 "Track 2" off
3 "Track 3" off
4 "All Tracks" off)
choices=$("$mycmd[@]" "$options[@]" 2>&1 >/dev/tty)
clear
for choice in $choices
do
case $choice in
1)
echo "Track1"
;;
2)
echo "track2"
;;
3)
echo "track3"
;;
4)
echo "All Tracks"
;;
esac
linux dialog
I am using Cdparanoia and Sox (play) to play CD's on an old Nokia internet tablet. I am using 'dialog' with the checklist option, to either select individual tracks or the entire disk for playback.
How can I adapt the script so that it can find out the number of tracks on the CD and so create a checkbox for each track (and name them track1, track2 etc)
I can find the number of tracks:
var=`cdparanoia -sQ |& cat | wc -l`; echo $[ $var - 8 ]
and the script that I am currently using is based on:
#!/bin/bash
mycmd=(dialog --separate-output --checklist "Select options:" 22 76 16)
options=(1 "Track 1" off # any option can be set to default to "on"
2 "Track 2" off
3 "Track 3" off
4 "All Tracks" off)
choices=$("$mycmd[@]" "$options[@]" 2>&1 >/dev/tty)
clear
for choice in $choices
do
case $choice in
1)
echo "Track1"
;;
2)
echo "track2"
;;
3)
echo "track3"
;;
4)
echo "All Tracks"
;;
esac
linux dialog
edited Oct 23 '17 at 21:07
asked Oct 22 '17 at 23:34
Phil Turner
12
12
1
Actually that's not a checklist, but a menu (see the manual). As a start, you'd have to add a column to the array ofofftokens.
â Thomas Dickey
Oct 22 '17 at 23:41
Thanks, I've edited my post to show correct example code (It was late when I posted originally)
â Phil Turner
Oct 23 '17 at 7:26
add a comment |Â
1
Actually that's not a checklist, but a menu (see the manual). As a start, you'd have to add a column to the array ofofftokens.
â Thomas Dickey
Oct 22 '17 at 23:41
Thanks, I've edited my post to show correct example code (It was late when I posted originally)
â Phil Turner
Oct 23 '17 at 7:26
1
1
Actually that's not a checklist, but a menu (see the manual). As a start, you'd have to add a column to the array of
off tokens.â Thomas Dickey
Oct 22 '17 at 23:41
Actually that's not a checklist, but a menu (see the manual). As a start, you'd have to add a column to the array of
off tokens.â Thomas Dickey
Oct 22 '17 at 23:41
Thanks, I've edited my post to show correct example code (It was late when I posted originally)
â Phil Turner
Oct 23 '17 at 7:26
Thanks, I've edited my post to show correct example code (It was late when I posted originally)
â Phil Turner
Oct 23 '17 at 7:26
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f399799%2fvariable-number-of-checkboxes-in-dialog%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Actually that's not a checklist, but a menu (see the manual). As a start, you'd have to add a column to the array of
offtokens.â Thomas Dickey
Oct 22 '17 at 23:41
Thanks, I've edited my post to show correct example code (It was late when I posted originally)
â Phil Turner
Oct 23 '17 at 7:26