(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:db) op: assign_op.Equal rhs: {(DQ (/usr/lib/games/state.capitals.txt))} spids: [10] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-r)} {(DQ ($ Id.VSub_DollarName '$db'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:33) ) ] action: [ (command.Simple words: [ {(echo)} { (DQ ($ Id.VSub_Number '$0') (": Can't open ") ($ Id.VSub_DollarName '$db') (' for reading.') ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:47) fd: -1 arg_word: {(2)} ) ] ) (command.Simple words: [ {(echo)} {(DQ ('(get http://www.intuitive.com/wicked/examples/state.capitals.txt'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:57) fd: -1 arg_word: {(2)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('save the file as ') ($ Id.VSub_DollarName '$db') (" and you're ready to play!)") ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:69) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:73) arg_word: {(1)} ) ] spids: [19 35] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guesses) op: assign_op.Equal rhs: {(0)} spids: [80] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:82) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:correct) op: assign_op.Equal rhs: {(0)} spids: [84] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:86) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:total) op: assign_op.Equal rhs: {(0)} spids: [88] ) ] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:92) cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ (quit))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:109) ) ] body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:thiskey) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:118) command_list: (command.CommandList children: [(C {(randomquote)} {($ Id.VSub_DollarName '$db')})] ) ) ) } spids: [116] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:state) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:139) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$thiskey')}) (C {(cut)} {(-d) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\ ' span_id:149) ) } {(-f1)} ) (C {(sed)} {(SQ (Token id:Id.Lit_Chars val:'s/-/ /g' span_id:158))}) ] negated: F ) ] ) ) ) } spids: [137] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:city) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:166) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$thiskey')}) (C {(cut)} {(-d) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\ ' span_id:176) ) } {(-f2)} ) (C {(sed)} {(SQ (Token id:Id.Lit_Chars val:'s/-/ /g' span_id:185))}) ] negated: F ) ] ) ) ) } spids: [164] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:match) op: assign_op.Equal rhs: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:193) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$city')}) (C {(tr)} {(SQ (Token id:Id.Lit_Chars val:'[:upper:]' span_id:203))} {(SQ (Token id:Id.Lit_Chars val:'[:lower:]' span_id:207))} ) ] negated: F ) ] ) ) ) } spids: [191] ) ] ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guess) op: assign_op.Equal rhs: {(DQ ('??'))} spids: [214] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:219) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:total) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$total')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [221] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:233) ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('What city is the capital of ') ($ Id.VSub_DollarName '$state') ('?'))}) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:266) cond: [ (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ ($ Id.VSub_DollarName '$match'))} {(-a)} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ (next))} {(-a)} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ (quit))} {(Id.Lit_RBracket ']')} ) ] body: (command.DoGroup children: [ (C {(/bin/echo)} {(-n)} {(DQ ('Answer: '))}) (C {(read)} {(guess)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.Lit_Equals '=')} {(DQ ($ Id.VSub_DollarName '$match'))} {(-o)} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.Lit_Equals '=')} {(DQ ($ Id.VSub_DollarName '$city'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:356) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('*** Absolutely correct! Well done! ***'))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:correct) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$correct')} ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [374] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guess) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$match')} spids: [387] ) ] ) ] spids: [328 358] ) (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.Lit_Equals '=')} {(DQ (next))} {(-o)} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.Lit_Equals '=')} {(DQ (quit))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:419) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ($ Id.VSub_DollarName '$city') (' is the capital of ') ($ Id.VSub_DollarName '$state') (.) ) } ) ] spids: [391 421] ) ] else_action: [(C {(echo)} {(DQ ("I'm afraid that's not correct."))})] ) ] ) ) ] ) ) (C {(echo)} { (DQ ('You got ') ($ Id.VSub_DollarName '$correct') (' out of ') ($ Id.VSub_DollarName '$total') (' presented.') ) } ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:473) arg_word:{(0)}) ] )