(command.CommandList children: [ (command.ShAssignment left: <Id.Lit_VarLike 'date='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'date='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'date='> name:date) op: assign_op.Equal rhs: { (DQ (CommandSub left_token: <Id.Left_Backtick '`'> child: (command.Simple blame_tok: <which> more_env: [] words: [{<which>} {<date>}] redirects: [] do_fork: T ) right: <Id.Backtick_Right '`'> ) ) } ) ] redirects: [] ) (command.ShFunction keyword: <Id.KW_Function function> name_tok: <daysInMonth> name: daysInMonth body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Case case_kw: <Id.KW_Case case> to_match: (case_arg.Word w:{($ Id.VSub_Number 1)}) arms_start: <Id.KW_In in> arms: [ (CaseArm left: <1> pattern: (pat.Words words:[{<1>} {<3>} {<5>} {<7>} {<8>} {<10>} {<12>}]) middle: <Id.Right_CasePat _> action: [ (command.ShAssignment left: <Id.Lit_VarLike 'dim='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'dim='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dim='> name:dim) op: assign_op.Equal rhs: {<31>} ) ] redirects: [] ) ] right: <Id.Op_DSemi _> ) (CaseArm left: <4> pattern: (pat.Words words:[{<4>} {<6>} {<9>} {<11>}]) middle: <Id.Right_CasePat _> action: [ (command.ShAssignment left: <Id.Lit_VarLike 'dim='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'dim='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dim='> name:dim) op: assign_op.Equal rhs: {<30>} ) ] redirects: [] ) ] right: <Id.Op_DSemi _> ) (CaseArm left: <2> pattern: (pat.Words words:[{<2>}]) middle: <Id.Right_CasePat _> action: [ (command.ShAssignment left: <Id.Lit_VarLike 'dim='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'dim='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dim='> name:dim) op: assign_op.Equal rhs: {<29>} ) ] redirects: [] ) ] right: <Id.Op_DSemi _> ) (CaseArm left: <Id.Lit_Star '*'> pattern: (pat.Words words:[{<Id.Lit_Star '*'>}]) middle: <Id.Right_CasePat _> action: [ (command.ShAssignment left: <Id.Lit_VarLike 'dim='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'dim='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dim='> name:dim) op: assign_op.Equal rhs: {<-1>} ) ] redirects: [] ) ] right: <Id.Op_DSemi _> ) ] arms_end: <Id.KW_Esac esac> redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction keyword: <Id.KW_Function function> name_tok: <isleap> name: isleap body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment left: <Id.Lit_VarLike 'leapyear='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'leapyear='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'leapyear='> name:leapyear) op: assign_op.Equal rhs: { (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (command.Simple blame_tok: <Id.VSub_DollarName '$date'> more_env: [] words: [ {($ Id.VSub_DollarName date)} {<-d>} {<'12/31/'> ($ Id.VSub_Number 1)} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <grep> more_env: [] words: [{<grep>} {<366>}] redirects: [] do_fork: T ) ] ops: [<Id.Op_Pipe _>] ) right: <Id.Eof_RParen _> ) } ) ] redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.If if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '#')} {<-ne>} {<3>} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.Simple blame_tok: <echo> more_env: [] words: [ {<echo>} { (DQ <'Usage: '> (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <basename> more_env: [] words: [{<basename>} {($ Id.VSub_Number 0)}] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) <' mon day year'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <echo> more_env: [] words: [{<echo>} {(DQ <' with just numerical values (ex: 7 7 1776)'>)}] redirects: [] do_fork: T ) (command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [156 170] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) (command.Simple blame_tok: <Id.VSub_DollarName '$date'> more_env: [] 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 if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '?')} {<-ne>} {<0>} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.Sentence child: (command.Simple blame_tok: <echo> more_env: [] words: [ {<echo>} { (DQ <'Sorry, but '> (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <basename> more_env: [] words: [{<basename>} {($ Id.VSub_Number 0)}] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) <' 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 keyword:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [215 229] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) (command.Simple blame_tok: <eval> more_env: [] words: [ {<eval>} { (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.VSub_DollarName '$date'> more_env: [] words: [ {($ Id.VSub_DollarName date)} {(DQ <'+thismon=%m;thisday=%d;thisyear=%Y;dayofyear=%j'>)} ] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ] redirects: [] do_fork: T ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment left: <Id.Lit_VarLike 'startmon='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'startmon='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'startmon='> name:startmon) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment left: <Id.Lit_VarLike 'startday='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'startday='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'startday='> name:startday) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (command.ShAssignment left: <Id.Lit_VarLike 'startyear='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'startyear='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'startyear='> name:startyear) op: assign_op.Equal rhs: {($ Id.VSub_Number 3)} ) ] redirects: [] ) ] ) (command.Simple blame_tok: <daysInMonth> more_env: [] words: [{<daysInMonth>} {($ Id.VSub_DollarName startmon)}] redirects: [] do_fork: T ) (command.If if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName startday)} {<-lt>} {<0>} {<-o>} {($ Id.VSub_DollarName startday)} {<-gt>} {($ Id.VSub_DollarName dim)} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.Sentence child: (command.Simple blame_tok: <echo> more_env: [] 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 keyword:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [287 309] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) (command.If if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName startmon)} {<-eq>} {<2>} {<-a>} {($ Id.VSub_DollarName startday)} {<-eq>} {<29>} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.Simple blame_tok: <isleap> more_env: [] words: [{<isleap>} {($ Id.VSub_DollarName startyear)}] redirects: [] do_fork: T ) (command.If if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName leapyear))} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.Simple blame_tok: <echo> more_env: [] 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 keyword: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [364 378] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) ] spids: [334 356] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'startdatefmt='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'startdatefmt='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'startdatefmt='> name:startdatefmt) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName startmon) <'/'> ($ Id.VSub_DollarName startday) <'/'> ($ Id.VSub_DollarName startyear) ) } ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'calculate='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'calculate='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'calculate='> name:calculate) op: assign_op.Equal rhs: { (DQ (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.VSub_DollarName '$date'> more_env: [] words: [ {($ Id.VSub_DollarName date)} {<-d>} {(DQ <'12/31/'> ($ Id.VSub_DollarName startyear))} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } right: <Id.Right_DollarDParen _> ) <' - '> (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.VSub_DollarName '$date'> more_env: [] words: [ {($ Id.VSub_DollarName date)} {<-d>} {($ Id.VSub_DollarName startdatefmt)} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } right: <Id.Right_DollarDParen _> ) ) } ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'daysleftinyear='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'daysleftinyear='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'daysleftinyear='> name:daysleftinyear) op: assign_op.Equal rhs: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: {($ Id.VSub_DollarName calculate)} right: <Id.Right_DollarDParen _> ) } ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'daysbetweenyears='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'daysbetweenyears='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'daysbetweenyears='> name:daysbetweenyears) op: assign_op.Equal rhs: {<0>} ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'tempyear='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'tempyear='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tempyear='> name:tempyear) op: assign_op.Equal rhs: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName startyear)} right: {<Id.Lit_Digits 1>} ) right: <Id.Right_DollarDParen _> ) } ) ] redirects: [] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName tempyear)} {<-lt>} {($ Id.VSub_DollarName thisyear)} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.ShAssignment left: <Id.Lit_VarLike 'daysbetweenyears='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'daysbetweenyears='> lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'daysbetweenyears='> name: daysbetweenyears ) op: assign_op.Equal rhs: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName daysbetweenyears)} right: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.VSub_DollarName '$date'> more_env: [] words: [ {($ Id.VSub_DollarName date)} {<-d>} {(DQ <'12/31/'> ($ Id.VSub_DollarName tempyear))} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>} ] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } right: <Id.Right_DollarDParen _> ) } ) right: <Id.Right_DollarDParen _> ) } ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'tempyear='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'tempyear='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tempyear='> name:tempyear) op: assign_op.Equal rhs: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName tempyear)} right: {<Id.Lit_Digits 1>} ) right: <Id.Right_DollarDParen _> ) } ) ] redirects: [] ) ] right: <Id.KW_Done done> ) redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'dayofyear='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'dayofyear='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dayofyear='> name:dayofyear) op: assign_op.Equal rhs: { (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.VSub_DollarName '$date'> more_env: [] words: [{($ Id.VSub_DollarName date)} {<Id.Lit_Other '+'> <Id.Lit_Other '%'> <j>}] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'totaldays='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'totaldays='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'totaldays='> name:totaldays) op: assign_op.Equal rhs: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.Binary op_id: Id.Arith_Plus left: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> ($ Id.VSub_DollarName daysleftinyear) } right: <Id.Right_DollarDParen _> ) } right: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> ($ Id.VSub_DollarName daysbetweenyears) } right: <Id.Right_DollarDParen _> ) } ) right: { (word_part.ArithSub left: <Id.Left_DollarDParen '$(('> anode: {<Id.Lit_Digits 10> <Id.Lit_Pound '#'> ($ Id.VSub_DollarName dayofyear)} right: <Id.Right_DollarDParen _> ) } ) right: <Id.Right_DollarDParen _> ) } ) ] redirects: [] ) (command.Simple blame_tok: <'/bin/echo'> more_env: [] words: [ {<'/bin/echo'>} {<-n>} { (DQ ($ Id.VSub_DollarName totaldays) <' days have elapsed between '> ($ Id.VSub_DollarName startmon) <'/'> ($ Id.VSub_DollarName startday) <'/'> ($ Id.VSub_DollarName startyear) <' '> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <echo> more_env: [] words: [ {<echo>} { (DQ <'and today, day '> ($ Id.VSub_DollarName dayofyear) <' of '> ($ Id.VSub_DollarName thisyear) <.> ) } ] redirects: [] do_fork: T ) (command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] )