Dialog Checklist

Discussion in 'Programming/Scripts' started by naeblis, May 7, 2010.

  1. naeblis

    naeblis New Member

    I'm trying to create a dynamic dialog checklist for my shell script but I'm having problems with it. I want a checklist that gets the options from an array. I tried do
    Code:
    dialog \
    	--title "Create Multi-iso Restore Disc" \
    	--clear \
    	--nocancel \
    	--checklist "Select the iso's from the following list  " 20 61 5 \
    	for (( j = 1; j < $i; j++ )); do
    		"$j" "$fileName[$j]" off \
    	done
    	2> $tempfile
    
    but that does not work. Any suggestions?
     
  2. burschik

    burschik New Member

    Your statement is complete syntactic nonsense and probably failed with an error message like:

    Code:
    -bash: syntax error near unexpected token `do'
    The shell recognizes the first word of the command line ("dialog") as the command and everything else up to the first statement separator (";") as arguments to that command. In order to insert the output of one command into the command line of another, you can use command substitution, or "xargs", provided that you can add the output to the end of the command line.

    Code:
    dialog --checklist $(commands)
    Code:
    commands | xargs dialog --checklist
     

Share This Page