(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:wordlib) op: assign_op.Equal rhs: {(DQ (/usr/lib/games/long-words.txt))} spids: [10] ) ] ) (command.ShFunction name: scrambleword body: (command.BraceGroup children: [ (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:34) command_list: (command.CommandList children: [(C {(randomquote)} {($ Id.VSub_DollarName '$wordlib')})] ) ) ) } spids: [32] ) ] ) (C {(echo)} {(DQ ('Picked out a word!'))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:len) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:52) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$match')}) (C {(wc)} {(-c)}) (C {(sed)} {(SQ (Token id:Id.Lit_Chars val:'s/[^[:digit:]]//g' span_id:68))} ) ] negated: F ) ] ) ) } spids: [51] ) ] ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scrambled) op: assign_op.Equal rhs: {(DQ )} spids: [73] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:76) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:lastval) op: assign_op.Equal rhs: {(1)} spids: [78] ) ] ) (command.ForExpr init: (arith_expr.BinaryAssign op_id: Id.Arith_Equal left: (sh_lhs_expr.Name name:val) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) cond: (arith_expr.Binary op_id: Id.Arith_Less left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$val')}) right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$len')}) ) body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Percent left: (arith_expr.ArithWord w: {($ Id.VSub_DollarName '$RANDOM')} ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 2)}) ) ) } {(-eq)} {(1)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:127) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scrambled) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$scrambled') (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 134 ) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$match')}) (C {(cut)} {(-c) ($ Id.VSub_DollarName '$val')}) ] negated: F ) ] ) ) } spids: [132] ) ] ) ] spids: [108 129] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:scrambled) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:152) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ Id.VSub_DollarName '$match')}) (C {(cut)} {(-c) ($ Id.VSub_DollarName '$val')}) ] negated: F ) ] ) ) ($ Id.VSub_DollarName '$scrambled') } spids: [151] ) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:val) 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 '$val')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [170] ) ] ) ] ) ) ] ) ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-r)} {($ Id.VSub_DollarName '$wordlib')} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:200) ) ] action: [ (command.Simple words: [ {(echo)} { (DQ ($ Id.VSub_Number '$0') (': Missing word library ') ($ Id.VSub_DollarName '$wordlib') ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:213) fd: -1 arg_word: {(2)} ) ] ) (command.Simple words: [ {(echo)} {(DQ ('(online: http://www.intuitive.com/wicked/examples/long-words.txt'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:223) fd: -1 arg_word: {(2)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('save the file as ') ($ Id.VSub_DollarName '$wordlib') (" and you're ready to play!)") ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:235) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:239) arg_word: {(1)} ) ] spids: [188 202] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:newgame) op: assign_op.Equal rhs: {(DQ )} spids: [246] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:249) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guesses) op: assign_op.Equal rhs: {(0)} spids: [251] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:253) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:correct) op: assign_op.Equal rhs: {(0)} spids: [255] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:257) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:total) op: assign_op.Equal rhs: {(0)} spids: [259] ) ] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_Until val:until span_id:264) cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.Lit_Equals '=')} {(DQ (quit))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:280) ) ] body: (command.DoGroup children: [ (C {(scrambleword)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('You need to unscramble: ') ($ Id.VSub_DollarName '$scrambled'))}) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guess) op: assign_op.Equal rhs: {(DQ ('??'))} spids: [305] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:310) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guesses) op: assign_op.Equal rhs: {(0)} spids: [312] ) ] ) (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: [316] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:330) 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 (quit))} {(-a)} {(DQ ($ Id.VSub_DollarName '$guess'))} {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ (next))} {(Id.Lit_RBracket ']')} ) ] body: (command.DoGroup children: [ (C {(echo)} {(DQ )}) (C {(/bin/echo)} {(-n)} {(DQ ('Your guess (quit|next) : '))}) (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'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:416) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guesses) 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 '$guesses')} ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [421] ) ] ) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ('*** You got it with tries = ') (${ Id.VSub_Name guesses) ('! Well done!! ***') ) } ) (C {(echo)} {(DQ )}) (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: [458] ) ] ) ] spids: [400 418] ) (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:499) ) ] action: [ (C {(echo)} { (DQ ('The unscrambled word was ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:508) ) ($ Id.VSub_DollarName '$match') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:510) ) ('. Your tries: ') ($ Id.VSub_DollarName '$guesses') ) } ) ] spids: [471 501] ) ] else_action: [ (C {(echo)} {(DQ ("Nope. That's not the unscrambled word. Try again."))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:guesses) 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 '$guesses')} ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [526] ) ] ) ] ) ] ) ) ] ) ) (C {(echo)} { (DQ ('Done. You correctly figured out ') ($ Id.VSub_DollarName '$correct') (' out of ') ($ Id.VSub_DollarName '$total') (' scrambled words.') ) } ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:558) arg_word:{(0)}) ] )