(command.CommandList children: [ (command.ShFunction name: k_string_get_line body: (BraceGroup children: [ (C {<local>} {<lineNo>} {<delim>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_get_line requires least 1 argument'>)}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] spids: [58 71] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:delim) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(SQ <'\\n '>)}) ) ) } spids: [90] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:lineNo) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [102] ) ] ) (C {<shift>}) (command.Pipeline children: [ (C {<echo>} {(DQ ($ Id.VSub_At '$@'))}) (C {<cut>} {<-d>} { (DQ (braced_var_sub token: <Id.VSub_Name delim> suffix_op: (suffix_op.Unary tok:<Id.VOp1_Percent '%'> arg_word:{<' '>}) ) ) } {<-f>} {(DQ (${ Id.VSub_Name lineNo))} ) ] negated: F ) ] ) ) (command.ShFunction name: k_string_pad_right body: (BraceGroup children: [ (C {<local>} {<length>} {<text>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_pad_right requires least 1 argument'>)}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] spids: [181 194] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:length) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [213] ) ] ) (C {<shift>}) (C {<printf>} {(DQ <'%-'> (${ Id.VSub_Name length) <s>)} {(DQ ($ Id.VSub_Star '$*'))}) ] ) ) (command.ShFunction name: k_string_pad_left body: (BraceGroup children: [ (C {<local>} {<length>} {<text>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_pad_left requires least 1 argument'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [280 293] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:length) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [312] ) ] ) (C {<shift>}) (C {<printf>} {(DQ <'%+'> (${ Id.VSub_Name length) <s>)} {(DQ ($ Id.VSub_Star '$*'))}) ] ) ) (command.ShFunction name: k_string_lower body: (BraceGroup children: [ (command.Pipeline children: [ (C {<printf>} {(DQ <'%s'>)} {(DQ ($ Id.VSub_Star '$*'))}) (C {<tr>} {(SQ <'[:upper:]'>)} {(SQ <'[:lower:]'>)}) ] negated: F ) ] ) ) (command.ShFunction name: k_string_upper body: (BraceGroup children: [ (command.Pipeline children: [ (C {<printf>} {(DQ <'%s'>)} {(DQ ($ Id.VSub_Star '$*'))}) (C {<tr>} {(SQ <'[:lower:]'>)} {(SQ <'[:upper:]'>)}) ] negated: F ) ] ) ) (command.ShFunction name: k_string_contains body: (BraceGroup children: [ (C {<local>} {<substring>} {<string>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-lt>} {<2>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_contains requires least 2 arguments'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [483 496] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:substring) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [515] ) ] ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:string) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Star '$*'))} spids: [526] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} { (DQ (braced_var_sub token: <Id.VSub_Name string> prefix_op: (Id.VSub_Pound) ) ) } {<-gt>} {<0>} {<Id.Lit_RBracket ']'>} ) (C {<Id.Lit_LBracket '['>} { (DQ (braced_var_sub token: <Id.VSub_Name string> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {<Id.Lit_Other '*'> (${ Id.VSub_Name substring) <Id.Lit_Other '*'> } ) ) ) } {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ (${ Id.VSub_Name string))} {<Id.Lit_RBracket ']'>} ) ] ) terminator: <Id.Op_Semi _> ) ] ) action: [(command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})] spids: [533 578] ) ] ) (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) ] ) ) (command.ShFunction name: k_string_starts_with body: (BraceGroup children: [ (C {<local>} {<substring>} {<string>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-lt>} {<2>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_starts_with requires least 2 arguments'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [635 648] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:substring) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [667] ) ] ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:string) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Star '$*'))} spids: [678] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} { (DQ (braced_var_sub token: <Id.VSub_Name string> prefix_op: (Id.VSub_Pound) ) ) } {<-gt>} {<0>} {<Id.Lit_RBracket ']'>} ) (C {<Id.Lit_LBracket '['>} { (DQ (braced_var_sub token: <Id.VSub_Name string> suffix_op: (suffix_op.Unary tok: <Id.VOp1_DPercent '%%'> arg_word: {(${ Id.VSub_Name substring) <Id.Lit_Other '*'>} ) ) ) } {<Id.Lit_Equals '='>} {(DQ )} {<Id.Lit_RBracket ']'>} ) ] ) terminator: <Id.Op_Semi _> ) ] ) action: [(command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})] spids: [685 725] ) ] ) (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) ] ) ) (command.ShFunction name: k_string_ends_with body: (BraceGroup children: [ (C {<local>} {<substring>} {<string>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-lt>} {<2>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_ends_with requires least 2 arguments'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [782 795] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:substring) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [814] ) ] ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:string) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Star '$*'))} spids: [825] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} { (DQ (braced_var_sub token: <Id.VSub_Name string> prefix_op: (Id.VSub_Pound) ) ) } {<-gt>} {<0>} {<Id.Lit_RBracket ']'>} ) (C {<Id.Lit_LBracket '['>} { (DQ (braced_var_sub token: <Id.VSub_Name string> suffix_op: (suffix_op.Unary tok: <Id.VOp1_DPound '##'> arg_word: {<Id.Lit_Other '*'> (${ Id.VSub_Name substring)} ) ) ) } {<Id.Lit_Equals '='>} {(DQ )} {<Id.Lit_RBracket ']'>} ) ] ) terminator: <Id.Op_Semi _> ) ] ) action: [(command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>})] spids: [832 872] ) ] ) (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) ] ) ) (command.ShFunction name: k_string_remove_start body: (BraceGroup children: [ (C {<local>} {<substring>} {<string>} {<Id.Lit_VarLike 'greedy='> <false>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_bool_parse>} { (DQ (braced_var_sub token: <Id.VSub_Name REMOVE_GREEDY> suffix_op: (suffix_op.Unary tok: <Id.VTest_ColonHyphen ':-'> arg_word: (word.Empty) ) ) ) } ) ) ) } {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:greedy) op: assign_op.Equal rhs: {<true>} spids: [960] ) ] ) ] spids: [933 957] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-lt>} {<2>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_remove_start requires least 2 arguments'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [968 981] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:substring) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [1000] ) ] ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:string) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Star '$*'))} spids: [1011] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name greedy)} {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<printf>} {(DQ <'%s'>)} { (DQ (braced_var_sub token: <Id.VSub_Name string> suffix_op: (suffix_op.Unary tok: <Id.VOp1_DPound '##'> arg_word: {(${ Id.VSub_Name substring)} ) ) ) } ) ] spids: [1018 1033] ) ] else_action: [ (C {<printf>} {(DQ <'%s'>)} { (DQ (braced_var_sub token: <Id.VSub_Name string> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Pound '#'> arg_word: {(${ Id.VSub_Name substring)} ) ) ) } ) ] ) ] ) ) (command.ShFunction name: k_string_remove_end body: (BraceGroup children: [ (C {<local>} {<substring>} {<string>} {<Id.Lit_VarLike 'greedy='> <false>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_bool_parse>} { (DQ (braced_var_sub token: <Id.VSub_Name REMOVE_GREEDY> suffix_op: (suffix_op.Unary tok: <Id.VTest_ColonHyphen ':-'> arg_word: (word.Empty) ) ) ) } ) ) ) } {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:greedy) op: assign_op.Equal rhs: {<true>} spids: [1150] ) ] ) ] spids: [1123 1147] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-lt>} {<2>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<k_log_err>} {(DQ <'k_string_remove_start requires least 2 arguments'>)}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [1158 1171] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:substring) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [1190] ) ] ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:string) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Star '$*'))} spids: [1201] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name greedy)} {<Id.Lit_Equals '='>} {<true>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<printf>} {(DQ <'%s'>)} { (DQ (braced_var_sub token: <Id.VSub_Name string> suffix_op: (suffix_op.Unary tok: <Id.VOp1_DPercent '%%'> arg_word: {(${ Id.VSub_Name substring)} ) ) ) } ) ] spids: [1208 1223] ) ] else_action: [ (C {<printf>} {(DQ <'%s'>)} { (DQ (braced_var_sub token: <Id.VSub_Name string> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {(${ Id.VSub_Name substring)} ) ) ) } ) ] ) ] ) ) (command.ShFunction name: k_string_join body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'separator='> (DQ (braced_var_sub token: <Id.VSub_Number 1> suffix_op: (suffix_op.Unary tok:<Id.VTest_Hyphen -> arg_word:(word.Empty)) ) ) } ) (C {<shift>}) (C {<k_string_remove_end>} {(DQ (${ Id.VSub_Name separator))} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(DQ <'%s'> (${ Id.VSub_Name separator))} {(DQ ($ Id.VSub_At '$@'))}) ) ) } ) ] ) ) (command.ShFunction name: k_string_trim body: (BraceGroup children: [ (command.Pipeline children: [ (C {<printf>} {(DQ <'%s'>)} {(DQ ($ Id.VSub_Star '$*'))}) (C {<sed>} {<-e>} {(DQ <'s/^[[:space:]]*//g; s/[[:space:]]*'> <Id.Lit_Dollar '$'> <'//g;'>)} ) ] negated: F ) ] ) ) (command.ShFunction name: k_string_keyword_error body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'input='> (DQ (${ Id.VSub_Number 1))}) (C {<shift>}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(DQ (${ Id.VSub_Name input))} {<Id.Lit_Equals '='>} {(DQ (${ Id.VSub_Number 1))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<printf>} {(DQ ($ Id.VSub_Number '$1'))}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<0>} ) ] spids: [1473 1494] ) ] ) (C {<shift>}) ] ) ) (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) ] ) ) (command.ShFunction name: k_string_keyword body: (BraceGroup children: [ (C {<local>} {<value>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:value) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_string_keyword_error>} {(DQ ($ Id.VSub_At '$@'))}) ) ) } spids: [1564] ) ] ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<echo>} {(DQ (${ Id.VSub_Name value))})] spids: [1562 1576] ) ] else_action: [ (C {<shift>} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: {($ Id.VSub_Pound '$#')} right: {<Id.Lit_Digits 1>} ) ) } ) (C {<echo>} {(DQ ($ Id.VSub_Number '$1'))}) ] ) ] ) ) ] )