(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: [18 22] ) ) } spids: [16] ) ] spids: [16] ) (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:[57])] spids: [57] ) ] spids: [41 55 60 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:[76])] spids: [76] ) ] spids: [66 74 79 16777215] ) (case_arm pat_list: [{(2)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dim) op:Equal rhs:{(29)} spids:[86])] spids: [86] ) ] spids: [82 84 89 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dim) op:Equal rhs:{(-1)} spids:[99])] spids: [99] ) ] spids: [95 97 102 16777215] ) ] spids: [34 38 108] ) ] spids: [31] ) spids: [27 30] ) (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: [125 142] ) } spids: [124] ) ] spids: [124] ) ] spids: [117] ) spids: [113 116] ) (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: [175 179] ) (' mon day year') ) } ) (C {(echo)} {(DQ (' with just numerical values (ex: 7 7 1776)'))}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 168] ) ] spids: [16777215 195] ) (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: [ (Sentence child: (SimpleCommand words: [ {(echo)} { (DQ ('Sorry, but ') (CommandSubPart command_list: (CommandList children: [(C {(basename)} {($ VSub_Number '$0')})] ) left_token: <Left_CommandSub '$('> spids: [234 238] ) (" can't run without GNU date.") ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) terminator: <Op_Semi ';'> ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 227] ) ] spids: [16777215 251] ) (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: [256 262] ) } ) (CommandList children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:startmon) op: Equal rhs: {($ VSub_Number '$1')} spids: [265] ) ] spids: [265] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:startday) op: Equal rhs: {($ VSub_Number '$2')} spids: [269] ) ] spids: [269] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:startyear) op: Equal rhs: {($ VSub_Number '$3')} spids: [273] ) ] spids: [273] ) ] ) (C {(daysInMonth)} {($ VSub_Name '$startmon')}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$startday')} {(-lt)} {(0)} {(-o)} {($ VSub_Name '$startday')} {(-gt)} {($ VSub_Name '$dim')} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Sentence child: (SimpleCommand words: [ {(echo)} { (DQ ('Invalid: Month #') ($ VSub_Name '$startmon') (' 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 307] ) ] spids: [16777215 329] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$startmon')} {(-eq)} {(2)} {(-a)} {($ VSub_Name '$startday')} {(-eq)} {(29)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(isleap)} {($ VSub_Name '$startyear')}) (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 ($ VSub_Name '$startyear') (" 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 376] ) ] spids: [16777215 395] ) ] spids: [16777215 354] ) ] spids: [16777215 397] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:startdatefmt) op: Equal rhs: { (DQ ($ VSub_Name '$startmon') (/) ($ VSub_Name '$startday') (/) ($ VSub_Name '$startyear')) } spids: [418] ) ] spids: [418] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:calculate) op: Equal rhs: { (DQ (ArithSubPart anode: (ArithWord w: {(Lit_Digits 10) (Lit_Pound '#') (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(-d)} {(DQ (12/31/) ($ VSub_Name '$startyear'))} {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [433 446] ) } ) spids: [430 448] ) (' - ') (ArithSubPart anode: (ArithWord w: {(Lit_Digits 10) (Lit_Pound '#') (CommandSubPart command_list: (CommandList children: [ (C {($ VSub_Name '$date')} {(-d)} {($ VSub_Name '$startdatefmt')} {(Lit_Other '+') (Lit_Other '%') (j)} ) ] ) left_token: <Left_CommandSub '$('> spids: [453 463] ) } ) spids: [450 465] ) ) } spids: [428] ) ] spids: [428] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:daysleftinyear) op: Equal rhs: {(ArithSubPart anode:(ArithWord w:{($ VSub_Name '$calculate')}) spids:[470 475])} spids: [469] ) ] spids: [469] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:daysbetweenyears) op:Equal rhs:{(0)} spids:[482])] spids: [482] ) (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 '$startyear')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [486 495] ) } spids: [485] ) ] spids: [485] ) (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$tempyear')} {(-lt)} {($ VSub_Name '$thisyear')} {(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: { (ArithSubPart anode: (ArithWord w: {(Lit_Digits 10) (Lit_Pound '#') (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: [524 537] ) } ) spids: [521 539] ) } ) ) spids: [516 541] ) } spids: [515] ) ] spids: [515] ) (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: [545 554] ) } spids: [544] ) ] spids: [544] ) ] spids: [512 556] ) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dayofyear) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {($ VSub_Name '$date')} {(Lit_Other '+') (Lit_Other '%') (j)})] ) left_token: <Left_CommandSub '$('> spids: [564 570] ) } spids: [563] ) ] spids: [563] ) (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: { (ArithSubPart anode: (ArithWord w: {(Lit_Digits 10) (Lit_Pound '#') ($ VSub_Name '$daysleftinyear') } ) spids: [583 588] ) } ) right: (ArithWord w: { (ArithSubPart anode: (ArithWord w: {(Lit_Digits 10) (Lit_Pound '#') ($ VSub_Name '$daysbetweenyears') } ) spids: [592 597] ) } ) ) right: (ArithWord w: { (ArithSubPart anode: (ArithWord w: {(Lit_Digits 10) (Lit_Pound '#') ($ VSub_Name '$dayofyear')} ) spids: [601 606] ) } ) ) spids: [581 609] ) } spids: [580] ) ] spids: [580] ) (C {(/bin/echo)} {(-n)} { (DQ ($ VSub_Name '$totaldays') (' days have elapsed between ') ($ VSub_Name '$startmon') (/) ($ VSub_Name '$startday') (/) ($ VSub_Name '$startyear') (' ') ) } ) (C {(echo)} {(DQ ('and today, day ') ($ VSub_Name '$dayofyear') (' of ') ($ VSub_Name '$thisyear') (.))} ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] )