(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:date) op: assign_op.Equal rhs: {(DQ (command_sub left_token:<Id.Left_Backtick '`'> child:(C {<which>} {<date>})))} spids: [16] ) ] ) (command.ShFunction name: daysInMonth body: (BraceGroup children: [ (command.Case to_match: {($ Id.VSub_Number '$1')} arms: [ (case_arm pat_list: [{<1>} {<3>} {<5>} {<7>} {<8>} {<10>} {<12>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dim) op: assign_op.Equal rhs: {<31>} spids: [59] ) ] ) ] spids: [43 57 62 -1] ) (case_arm pat_list: [{<4>} {<6>} {<9>} {<11>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dim) op: assign_op.Equal rhs: {<30>} spids: [78] ) ] ) ] spids: [68 76 81 -1] ) (case_arm pat_list: [{<2>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dim) op: assign_op.Equal rhs: {<29>} spids: [88] ) ] ) ] spids: [84 86 91 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dim) op: assign_op.Equal rhs: {<-1>} spids: [101] ) ] ) ] spids: [97 99 104 -1] ) ] ) ] ) ) (command.ShFunction name: isleap body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:leapyear) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {($ Id.VSub_DollarName '$date')} {<-d>} {<'12/31/'> ($ Id.VSub_Number '$1')} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ) (C {<grep>} {<366>}) ] negated: F ) ) } spids: [126] ) ] ) ] ) ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-ne>} {<3>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} { (DQ <'Usage: '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<basename>} {($ Id.VSub_Number '$0')}) ) <' mon day year'> ) } ) (C {<echo>} {(DQ <' with just numerical values (ex: 7 7 1776)'>)}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [156 170] ) ] ) (command.Simple words: [{($ Id.VSub_DollarName '$date')} {<--version>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>}) (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>}) ] do_fork: T ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-ne>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Sentence child: (command.Simple words: [ {<echo>} { (DQ <'Sorry, but '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<basename>} {($ Id.VSub_Number '$0')}) ) <' can\'t run without GNU date.'> ) } ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [215 229] ) ] ) (C {<eval>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {($ Id.VSub_DollarName '$date')} {(DQ <'+thismon=%m;thisday=%d;thisyear=%Y;dayofyear=%j'>)} ) ) } ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:startmon) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [267] ) ] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:startday) op: assign_op.Equal rhs: {($ Id.VSub_Number '$2')} spids: [271] ) ] ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:startyear) op: assign_op.Equal rhs: {($ Id.VSub_Number '$3')} spids: [275] ) ] ) ] ) (C {<daysInMonth>} {($ Id.VSub_DollarName '$startmon')}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$startday')} {<-lt>} {<0>} {<-o>} {($ Id.VSub_DollarName '$startday')} {<-gt>} {($ Id.VSub_DollarName '$dim')} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Sentence child: (command.Simple words: [ {<echo>} { (DQ <'Invalid: Month #'> ($ Id.VSub_DollarName '$startmon') <' only has '> ($ Id.VSub_DollarName '$dim') <' days.'> ) } ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [287 309] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$startmon')} {<-eq>} {<2>} {<-a>} {($ Id.VSub_DollarName '$startday')} {<-eq>} {<29>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<isleap>} {($ Id.VSub_DollarName '$startyear')}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$leapyear'))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} { (DQ ($ Id.VSub_DollarName '$startyear') <' wasn\'t a leapyear, so February only had 28 days.'> ) } ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [364 378] ) ] ) ] spids: [334 356] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:startdatefmt) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$startmon') <'/'> ($ Id.VSub_DollarName '$startday') <'/'> ($ Id.VSub_DollarName '$startyear') ) } spids: [420] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:calculate) op: assign_op.Equal rhs: { (DQ (word_part.ArithSub anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {($ Id.VSub_DollarName '$date')} {<-d>} {(DQ <'12/31/'> ($ Id.VSub_DollarName '$startyear'))} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ) ) } ) <' - '> (word_part.ArithSub anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {($ Id.VSub_DollarName '$date')} {<-d>} {($ Id.VSub_DollarName '$startdatefmt')} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ) ) } ) ) } spids: [430] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:daysleftinyear) op: assign_op.Equal rhs: {(word_part.ArithSub anode:{($ Id.VSub_DollarName '$calculate')})} spids: [471] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:daysbetweenyears) op: assign_op.Equal rhs: {<0>} spids: [484] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tempyear) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName '$startyear')} right: {<Id.Lit_Digits 1>} ) ) } spids: [487] ) ] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$tempyear')} {<-lt>} {($ Id.VSub_DollarName '$thisyear')} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:daysbetweenyears) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName '$daysbetweenyears')} right: { (word_part.ArithSub anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {($ Id.VSub_DollarName '$date')} {<-d>} {(DQ <'12/31/'> ($ Id.VSub_DollarName '$tempyear'))} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ) ) } ) } ) ) } spids: [517] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tempyear) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName '$tempyear')} right: {<Id.Lit_Digits 1>} ) ) } spids: [546] ) ] ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dayofyear) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {($ Id.VSub_DollarName '$date')} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>}) ) } spids: [565] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:totaldays) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.Binary op_id: Id.Arith_Plus left: { (word_part.ArithSub anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> ($ Id.VSub_DollarName '$daysleftinyear') } ) } right: { (word_part.ArithSub anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> ($ Id.VSub_DollarName '$daysbetweenyears') } ) } ) right: { (word_part.ArithSub anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> ($ Id.VSub_DollarName '$dayofyear')} ) } ) ) } spids: [582] ) ] ) (C {<'/bin/echo'>} {<-n>} { (DQ ($ Id.VSub_DollarName '$totaldays') <' days have elapsed between '> ($ Id.VSub_DollarName '$startmon') <'/'> ($ Id.VSub_DollarName '$startday') <'/'> ($ Id.VSub_DollarName '$startyear') <' '> ) } ) (C {<echo>} { (DQ <'and today, day '> ($ Id.VSub_DollarName '$dayofyear') <' of '> ($ Id.VSub_DollarName '$thisyear') <.> ) } ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] )