(command.CommandList children: [ (command.ShFunction name: printHelp body: (command.BraceGroup children: [ (C {<echo>} {(DQ <'Usage: '> ($ Id.VSub_Number '$0') <' -f find -r replace FILES_TO_RENAME*'>)} ) (C {<echo>} {<-e>} {(DQ <Id.Lit_Other '\\'> <'t-f The text to find in the filename'>)}) (C {<echo>} {<-e>} {(DQ <Id.Lit_Other '\\'> <'t-r The text used to replace with in the filename'>)} ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ) (command.WhileUntil keyword: <Id.KW_While while> cond: [ (command.Sentence child: (C {<getopts>} {(DQ <'f:r:'>)} {<opt>}) terminator: <Id.Op_Semi _> ) ] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_DollarName '$opt'))} arms: [ (case_arm pat_list: [{<r>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:replace) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [75] ) ] ) ] spids: [71 73 80 -1] ) (case_arm pat_list: [{<f>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:fnd) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))} spids: [87] ) ] ) ] spids: [83 85 92 -1] ) (case_arm pat_list: [{<Id.Lit_QMark '?'>}] action: [(C {<printHelp>})] spids: [95 97 101 -1] ) ] ) ] ) ) (C {<shift>} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$OPTIND')}) right: (arith_expr.ArithWord w:{<Id.Lit_Digits 1>}) ) ) } ) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<Id.Lit_LBracket '['>} {<-z>} {($ Id.VSub_DollarName '$replace')} {<Id.Lit_RBracket ']'>} ) (C {<Id.Lit_LBracket '['>} {<-z>} {($ Id.VSub_DollarName '$fnd')} {<Id.Lit_RBracket ']'>}) ] ) ] action: [ (command.Sentence child: (C {<echo>} {(DQ <'Need a string to find and a string to replace'>)}) terminator: <Id.Op_Semi _> ) (C {<printHelp>}) ] spids: [123 143] ) ] ) (command.ForEach iter_name: i iter_words: [{($ Id.VSub_At '$@')}] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:newname) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_DollarName '$i')}) (C {<sed>} { (DQ <s/> ($ Id.VSub_DollarName '$fnd') </> ($ Id.VSub_DollarName '$replace') </> ) } ) ] negated: F ) ] ) ) } spids: [170] ) ] ) (C {<mv>} {($ Id.VSub_DollarName '$i')} {($ Id.VSub_DollarName '$newname')}) (C {<echo>} { (DQ <'Renamed file '> ($ Id.VSub_DollarName '$i') <' to '> ($ Id.VSub_DollarName '$newname') ) } ) ] ) ) ] )