Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nested if, with a nested switch, which has another nested switch

Status
Not open for further replies.

davidbelarus

Programmer
Oct 21, 2011
26
0
0
US
basically
if
switch
switch
this is the code and the errors i am getting.

code
+++++++++++++++++++++++++++++++++++++++++++++
set brand 100
set version 1200
set name "hr20"

puts "Version is $version\n"

if {$version <1300} {
#standard graphics bootlines from wiki
switch -glob $name hr20 { switch -glob $brand 100 {puts "This is Hr20 recorded as $name, version $version less than 1300 Thompson $brand\n"} 700 {puts "This is Hr20 recorded as $name, version $version less than 1300 Pace $brand\n"} default {puts "This is Hr20 recorded as $name, version $version less than 1300 Unidentified brand $brand\n"}
} \ #closing hr20

h24 { send "This is H24 recorded as $name, version $version less than 1300\n\n"
expect "cfe>" } default { send "default case what Box? $name, less than 1300 version\n"
expect "cfe>" }
} elseif {$version >= 1300} {
#HDgraphics
switch -glob $name h23 { send "This is H23 recorded as $name, version $version more than 1300\n"
expect "cfe>" } h24 { send "This is H24 recorded as $name, version $version more than 1300\n\n"
expect "cfe>" } default { send "default case what Box? $name, more than 1300 version\n"
expect "cfe>" }
} else {
puts "Last esle for unidentified version number. Box $name, what version $version\n"}

output/debug data
+++++++++++++++++++++++++++++++++++++++++

david@FunStuff-Linux:~$ expect /home/david/Desktop/tuesday2.sh
Version is 1200

This is Hr20 recorded as hr20, version 1200 less than 1300 Thompson 100

invalid command name "h24"
while executing
"h24 { send "This is H24 recorded as $name, version $version less than 1300\n\n"
expect "cfe>" } defa..."
invoked from within
"if {$version <1300} {
#standard graphics bootlines from wiki
switch -glob $name hr20 { switch -glob $brand 100 {puts "This is Hr20 recorded as $n..."
(file "/home/david/Desktop/tuesday2.sh" line 8)
david@FunStuff-Linux:~$
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top