(command.CommandList
  children: [
    (command.ShFunction
      name: usage
      body: 
        (command.BraceGroup
          children: [
            (command.Subshell
              command_list: 
                (command.CommandList
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ('Usage:    ') 
                          (command_sub
                            left_token: <Left_Backtick '`'>
                            command_list: 
                              (command.CommandList
                                children: [(C {(basename)} {($ VSub_Number '$0')})]
                              )
                          ) (" ['grep options'] search_expr [file wildcard]\n") ('examples: ') 
                          (command_sub
                            left_token: <Left_Backtick '`'>
                            command_list: 
                              (command.CommandList
                                children: [(C {(basename)} {($ VSub_Number '$0')})]
                              )
                          ) (" 'main' '*.[ch]'          #fixed string search\n") ('          ') 
                          (command_sub
                            left_token: <Left_Backtick '`'>
                            command_list: 
                              (command.CommandList
                                children: [(C {(basename)} {($ VSub_Number '$0')})]
                              )
                          ) (" '(main|mane)' '*.[ch]'   #regular expression search\n") ('          ') 
                          (command_sub
                            left_token: <Left_Backtick '`'>
                            command_list: 
                              (command.CommandList
                                children: [(C {(basename)} {($ VSub_Number '$0')})]
                              )
                          ) (" '-F' 'main(' '*.[ch]'    #force fixed string search\n") ('          ') 
                          (command_sub
                            left_token: <Left_Backtick '`'>
                            command_list: 
                              (command.CommandList
                                children: [(C {(basename)} {($ VSub_Number '$0')})]
                              )
                          ) (" '-L -F' 'main(' '*.[ch]' #extra grep options")
                        )
                      }
                    )
                  ]
                )
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.AndOr
                  ops: [Op_DPipe]
                  children: [
                    (C {(Lit_LBracket '[')} {($ VSub_Pound '$#')} {(-eq)} {(0)} {(Lit_RBracket ']')})
                    (C {(Lit_LBracket '[')} {($ VSub_Pound '$#')} {(-gt)} {(3)} {(Lit_RBracket ']')})
                  ]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(usage)})]
        )
      ]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (command.Pipeline
          children: [
            (C {(echo)})
            (command.Simple
              words: [{(grep)} {(--color) (Lit_Equals '=') (auto)} {(DQ )}]
              redirects: [
                (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})
                (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
              ]
            )
          ]
          negated: F
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:colour) op:Equal rhs:{(DQ ('--color=auto'))})]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_LBracket '[')} {($ VSub_Pound '$#')} {(-eq)} {(1)} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:glob) op:Equal rhs:{(SQ <'*'>)})]
            )
          ]
        )
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_LBracket '[')} {($ VSub_Pound '$#')} {(-eq)} {(2)} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(test)} 
                              {
                                (DQ 
                                  (braced_var_sub
                                    token: <VSub_Number 1>
                                    suffix_op: (suffix_op.Unary op_id:VOp1_DPound arg_word:{('-*')})
                                  )
                                )
                              }
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {
                          (DQ ("Warning: treating '") ($ VSub_Number '$1') 
                            ("' as the grep pattern, not extra options.\n") ('If this is intended, avoid the warning with an empty first parameter.\n') 
                            ('If this is not intended, please specify the file wildcard.')
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:glob)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$2'))}
                )
              ]
            )
          ]
        )
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_LBracket '[')} {($ VSub_Pound '$#')} {(-eq)} {(3)} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:grep_options)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (C {(shift)})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:glob)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$2'))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.Pipeline
                  children: [
                    (C {(printf)} {(DQ ('%s') (Lit_Other '\\') (n))} 
                      {(DQ ($ VSub_DollarName '$grep_options'))}
                    )
                    (command.Simple
                      words: [{(grep)} {(-E)} {(--)} {(DQ ('-([EFGP]|regexp|fixed)'))}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_Great '>'>
                          fd: 16777215
                          arg_word: {(/dev/null)}
                        )
                        (redir.Redir
                          op: <Redir_GreatAnd '2>&'>
                          fd: 2
                          arg_word: {(1)}
                        )
                      ]
                    )
                  ]
                  negated: T
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.AndOr
              ops: [Op_DAmp Op_DPipe]
              children: [
                (command.Pipeline
                  children: [
                    (C {(echo)} {(DQ ($ VSub_Number '$1'))})
                    (command.Simple
                      words: [{(grep)} {(SQ <'[.[\\()*+?{|^$]'>)}]
                      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})]
                    )
                  ]
                  negated: F
                )
                (command.ShAssignment
                  pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:type) op:Equal rhs:{(DQ (-E))})]
                )
                (command.ShAssignment
                  pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:type) op:Equal rhs:{(DQ (-F))})]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:grep_options)
                  op: Equal
                  rhs: {(DQ ($ VSub_DollarName '$grep_options') (' ') ($ VSub_DollarName '$type'))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:repodirs)
          op: Equal
          rhs: {(DQ ('.git .svn CVS .hg .bzr _darcs'))}
        )
      ]
    )
    (command.ForEach
      iter_name: dir
      iter_words: [{($ VSub_DollarName '$repodirs')}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:repo_ign)
                  op: Equal
                  rhs: 
                    {
                      (DQ ($ VSub_DollarName '$repo_ign') 
                        (braced_var_sub
                          token: <VSub_Name repo_ign>
                          suffix_op: (suffix_op.Unary op_id:VTest_Plus arg_word:{(DQ (' -o '))})
                        ) ('-name ') ($ VSub_DollarName '$dir')
                      )
                    }
                )
              ]
            )
          ]
        )
    )
    (command.Pipeline
      children: [
        (C {(find)} {(.)} {(word_part.EscapedLiteral token:<Lit_EscapedChar '\\('>)} {(-type)} {(d)} {(-a)} 
          {(word_part.EscapedLiteral token:<Lit_EscapedChar '\\('>)} {($ VSub_DollarName '$repo_ign')} {(word_part.EscapedLiteral token:<Lit_EscapedChar '\\)'>)} 
          {(word_part.EscapedLiteral token:<Lit_EscapedChar '\\)'>)} {(-prune)} {(-o)} {(word_part.EscapedLiteral token:<Lit_EscapedChar '\\('>)} {(-type)} {(f)} {(-name)} 
          {(DQ ($ VSub_DollarName '$glob'))} {(-print0)} {(word_part.EscapedLiteral token:<Lit_EscapedChar '\\)'>)}
        )
        (command.Simple
          words: [
            {(xargs)}
            {(-0)}
            {(grep)}
            {($ VSub_DollarName '$colour')}
            {($ VSub_DollarName '$grep_options')}
            {(--)}
            {(DQ ($ VSub_Number '$1'))}
          ]
          more_env: [(env_pair name:GREP_COLOR val:{(DQ ('1;33;40'))}) (env_pair name:LANG val:{(C)})]
        )
      ]
      negated: F
    )
  ]
)