(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:retries)
          op: assign_op.Equal
          rhs: {(DQ <10>)}
          spids: [7]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:action)
          op: assign_op.Equal
          rhs: {(DQ <lock>)}
          spids: [15]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:nullcmd)
          op: assign_op.Equal
          rhs: {(DQ (command_sub left_token:<Id.Left_Backtick '`'> child:(C {<which>} {<true>})))}
          spids: [23]
        )
      ]
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: 
        (condition.Shell
          commands: [
            (command.Sentence
              child: (C {<getopts>} {(DQ <'lur:'>)} {<opt>})
              terminator: <Id.Op_Semi _>
            )
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{<l>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:action)
                          op: assign_op.Equal
                          rhs: {(DQ <lock>)}
                          spids: [63]
                        )
                      ]
                    )
                  ]
                  spids: [59 61 68 -1]
                )
                (case_arm
                  pat_list: [{<u>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:action)
                          op: assign_op.Equal
                          rhs: {(DQ <unlock>)}
                          spids: [75]
                        )
                      ]
                    )
                  ]
                  spids: [71 73 80 -1]
                )
                (case_arm
                  pat_list: [{<r>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:retries)
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_DollarName '$OPTARG'))}
                          spids: [87]
                        )
                      ]
                    )
                  ]
                  spids: [83 85 92 -1]
                )
              ]
            )
          ]
        )
    )
    (C {<shift>} 
      {
        (word_part.ArithSub
          anode: 
            (arith_expr.Binary
              op_id: Id.Arith_Minus
              left: {($ Id.VSub_DollarName '$OPTIND')}
              right: {<Id.Lit_Digits 1>}
            )
        )
      }
    )
    (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: [
            (command.Simple
              words: [{<cat>}]
              redirects: [
                (redir
                  op: <Id.Redir_DLess '<<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: 
                    (redir_param.HereDoc
                      here_begin: {<EOF>}
                      here_end_span_id: 148
                      stdin_parts: [
                        <'Usage: '>
                        ($ Id.VSub_Number '$0')
                        <' [-l|-u] [-r retries] LOCKFILE\n'>
                        <'Where -l requests a lock (the default), -u requests an unlock, -r X \n'>
                        <'specifies a max number of retries before it fails (default = '>
                        ($ Id.VSub_DollarName '$retries')
                        <').\n'>
                      ]
                    )
                )
                (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: [111 125]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-z>} 
                      {
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.Pipeline
                                children: [(C {<which>} {<lockfile>}) (C {<grep>} {<-v>} {(SQ <'^no '>)})]
                                negated: F
                              )
                          )
                        )
                      } {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {(DQ ($ Id.VSub_Number '$0') <' failed: \'lockfile\' utility not found in PATH.'>)}
              ]
              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: [161 189]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$action'))} 
                      {<Id.Lit_Equals '='>} {(DQ <lock>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.Pipeline
                              children: [
                                (command.Simple
                                  words: [
                                    {<lockfile>}
                                    {<-1>}
                                    {<-r>}
                                    {($ Id.VSub_DollarName '$retries')}
                                    {(DQ ($ Id.VSub_Number '$1'))}
                                  ]
                                  redirects: [
                                    (redir
                                      op: <Id.Redir_Great '2>'>
                                      loc: (redir_loc.Fd fd:2)
                                      arg: {<'/dev/null'>}
                                    )
                                  ]
                                  do_fork: T
                                )
                              ]
                              negated: T
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {(DQ ($ Id.VSub_Number '$0') <': Failed: Couldn\'t create lockfile in time'>)}
                      ]
                      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: [230 251]
                )
              ]
            )
          ]
          spids: [209 227]
        )
      ]
      else_action: [
        (command.If
          arms: [
            (if_arm
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-f>} 
                          {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              action: [
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ ($ Id.VSub_Number '$0') <': Warning: lockfile '> ($ Id.VSub_Number '$1') 
                        <' doesn\'t exist to unlock'>
                      )
                    }
                  ]
                  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: [278 294]
            )
          ]
        )
        (C {<rm>} {<-f>} {(DQ ($ Id.VSub_Number '$1'))})
      ]
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)