(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:date) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(which)} {(date)})]) left_token: <Left_Backtick '`'> spids: [21 25] ) ) } spids: [19] ) ] spids: [19] ) (FuncDef name: daysInMonth body: (BraceGroup children: [ (Case to_match: {($ VSub_Number '$1')} arms: [ (case_arm pat_list: [{(1)} {(3)} {(5)} {(7)} {(8)} {(10)} {(12)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dim) op:Equal rhs:{(31)} spids:[59])] spids: [59] ) ] spids: [43 57 62 16777215] ) (case_arm pat_list: [{(4)} {(6)} {(9)} {(11)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dim) op:Equal rhs:{(30)} spids:[78])] spids: [78] ) ] spids: [68 76 81 16777215] ) (case_arm pat_list: [{(2)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dim) op:Equal rhs:{(29)} spids:[88])] spids: [88] ) ] spids: [84 86 91 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dim) op:Equal rhs:{(-1)} spids:[101])] spids: [101] ) ] spids: [97 99 104 16777215] ) ] spids: [36 40 110] ) ] spids: [33] ) spids: [29 32] ) (FuncDef name: isleap body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:leapyear) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {($ VSub_Name '$date')} {(-d)} {(12/31/) ($ VSub_Number '$1')} {(Lit_Other '+') (Lit_Other '%') (j)} ) (C {(grep)} {(366)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [128 145] ) } spids: [127] ) ] spids: [127] ) ] spids: [119] ) spids: [115 118] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-ne)} {(3)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} { (DQ ('Usage: ') (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Number '$0')})]) left_token: <Left_CommandSub '$('> spids: [178 182] ) (' mon day year') ) } ) (C {(echo)} {(DQ (' with just numerical values (ex: 1 1 2020)'))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 171] ) ] spids: [16777215 198] ) (SimpleCommand words: [{($ VSub_Name '$date')} {(--version)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)}) (Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)}) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-ne)} {(0)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ('Sorry, but ') (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Number '$0')})]) left_token: <Left_CommandSub '$('> spids: [237 241] ) (" can't run without GNU date.") ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 230] ) ] spids: [16777215 253] ) (C {(eval)} { (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(DQ ('+thismon=%m;thisday=%d;thisyear=%Y;dayofyear=%j'))}) ] ) left_token: <Left_CommandSub '$('> spids: [258 264] ) } ) (CommandList children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:endmon) op: Equal rhs: {($ VSub_Number '$1')} spids: [267] ) ] spids: [267] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:endday) op: Equal rhs: {($ VSub_Number '$2')} spids: [271] ) ] spids: [271] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:endyear) op: Equal rhs: {($ VSub_Number '$3')} spids: [275] ) ] spids: [275] ) ] ) (C {(daysInMonth)} {($ VSub_Name '$endmon')}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$endday')} {(-lt)} {(0)} {(-o)} {($ VSub_Name '$endday')} {(-gt)} {($ VSub_Name '$dim')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [ {(echo)} { (DQ ('Invalid: Month #') ($ VSub_Name '$endmon') (' only has ') ($ VSub_Name '$dim') (' days.') ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 312] ) ] spids: [16777215 334] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$endmon')} {(-eq)} {(2)} {(-a)} {($ VSub_Name '$endday')} {(-eq)} {(29)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(isleap)} {($ VSub_Name '$endyear')}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$leapyear'))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ('Invalid: ') ($ VSub_Name '$endyear') (" wasn't a leapyear, so February only had 28 days.") ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 381] ) ] spids: [16777215 401] ) ] spids: [16777215 359] ) ] spids: [16777215 403] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$endyear')} {(-lt)} {($ VSub_Name '$thisyear')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [ {(echo)} { (DQ ('Invalid: ') ($ VSub_Name '$endmon') (/) ($ VSub_Name '$endday') (/) ($ VSub_Name '$endyear') (' is prior to the current year.') ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 420] ) ] spids: [16777215 444] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$endyear')} {(-eq)} {($ VSub_Name '$thisyear')} {(-a)} {($ VSub_Name '$endmon')} {(-lt)} {($ VSub_Name '$thismon')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [ {(echo)} { (DQ ('Invalid: ') ($ VSub_Name '$endmon') (/) ($ VSub_Name '$endday') (/) ($ VSub_Name '$endyear') (' is prior to the current month.') ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 469] ) ] spids: [16777215 493] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$endyear')} {(-eq)} {($ VSub_Name '$thisyear')} {(-a)} {($ VSub_Name '$endmon')} {(-eq)} {($ VSub_Name '$thismon')} {(-a)} {($ VSub_Name '$endday')} {(-lt)} {($ VSub_Name '$thisday')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [ {(echo)} { (DQ ('Invalid: ') ($ VSub_Name '$endmon') (/) ($ VSub_Name '$endday') (/) ($ VSub_Name '$endyear') (' is prior to the current date.') ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 526] ) ] spids: [16777215 550] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$endyear')} {(-eq)} {($ VSub_Name '$thisyear')} {(-a)} {($ VSub_Name '$endmon')} {(-eq)} {($ VSub_Name '$thismon')} {(-a)} {($ VSub_Name '$endday')} {(-eq)} {($ VSub_Name '$thisday')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [ {(echo)} { (DQ ('There are zero days between ') ($ VSub_Name '$endmon') (/) ($ VSub_Name '$endday') (/) ($ VSub_Name '$endyear') (' and today.') ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] spids: [16777215 583] ) ] spids: [16777215 607] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$endyear')} {(-eq)} {($ VSub_Name '$thisyear')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:totaldays) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w: { (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(-d)} { (DQ ($ VSub_Name '$endmon') (/) ($ VSub_Name '$endday') (/) ($ VSub_Name '$endyear') ) } {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [635 651] ) } ) right: (ArithWord w: { (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [655 661] ) } ) ) spids: [633 664] ) } spids: [632] ) ] spids: [632] ) ] spids: [16777215 628] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:thisdatefmt) op: Equal rhs: { (DQ ($ VSub_Name '$thismon') (/) ($ VSub_Name '$thisday') (/) ($ VSub_Name '$thisyear')) } spids: [687] ) ] spids: [687] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:calculate) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(-d)} {(DQ (12/31/) ($ VSub_Name '$thisyear'))} {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [700 713] ) (' - ') (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(-d)} {($ VSub_Name '$thisdatefmt')} {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [715 725] ) ) } spids: [698] ) ] spids: [698] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:daysleftinyear) op: Equal rhs: {(ArithSubPart anode:(ArithWord w:{($ VSub_Name '$calculate')}) spids:[731 736])} spids: [730] ) ] spids: [730] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:daysbetweenyears) op:Equal rhs:{(0)} spids:[745])] spids: [745] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tempyear) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$thisyear')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [750 759] ) } spids: [749] ) ] spids: [749] ) (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$tempyear')} {(-lt)} {($ VSub_Name '$endyear')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:daysbetweenyears) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$daysbetweenyears')}) right: (ArithWord w: { (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(-d)} {(DQ (12/31/) ($ VSub_Name '$tempyear'))} {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [787 800] ) } ) ) spids: [781 803] ) } spids: [780] ) ] spids: [780] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tempyear) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$tempyear')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [807 816] ) } spids: [806] ) ] spids: [806] ) ] spids: [777 819] ) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dayofyear) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(--date)} {($ VSub_Name '$endmon') (/) ($ VSub_Name '$endday') (/) ($ VSub_Name '$endyear') } {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [829 843] ) } spids: [828] ) ] spids: [828] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:totaldays) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$daysleftinyear')}) right: (ArithWord w:{($ VSub_Name '$daysbetweenyears')}) ) right: (ArithWord w:{($ VSub_Name '$dayofyear')}) ) spids: [856 869] ) } spids: [855] ) ] spids: [855] ) ] spids: [668 871] ) (C {(echo)} { (DQ ('There are ') ($ VSub_Name '$totaldays') (' days until the date ') ($ VSub_Name '$endmon') (/) ($ VSub_Name '$endday') (/) ($ VSub_Name '$endyear') (.) ) } ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] )