(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:delay) op:assign_op.Equal rhs:{<2>} spids:[10])]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:psize)
          op: assign_op.Equal
          rhs: {(DQ <'1200x900>'>)}
          spids: [16]
        )
      ]
    )
    (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.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ <'Usage: '> 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: (C {<basename>} {($ Id.VSub_Number '$0')})
                        ) <' watch-directory'>
                      )
                    }
                  ]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [25 39]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:watch)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_Number '$1'))}
          spids: [66]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-d>} 
                      {(DQ ($ Id.VSub_DollarName '$watch'))} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: (C {<basename>} {($ Id.VSub_Number '$0')})
                        ) <': specified watch directory '> ($ Id.VSub_DollarName '$watch') <' isn\'t a directory'>
                      )
                    }
                  ]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [72 88]
        )
      ]
    )
    (C {<cd>} {(DQ ($ Id.VSub_DollarName '$watch'))})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-ne>} {<0>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: (C {<basename>} {($ Id.VSub_Number '$0')})
                        ) <': failed trying to cd into '> ($ Id.VSub_DollarName '$watch')
                      )
                    }
                  ]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [123 137]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:suffixes)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<'file'>} {<Id.Lit_Star '*'>})
                        (C {<grep>} {<image>})
                        (C {<cut>} {<-d> <Id.Lit_Colon ':'>} {<-f1>})
                        (C {<rev>})
                        (C {<cut>} {<-d.>} {<-f1>})
                        (C {<rev>})
                        (C {<sort>})
                        (C {<uniq>})
                        (C {<sed>} {(SQ <'s/^/\\*./'>)})
                      ]
                      negated: F
                    )
                )
              )
            }
          spids: [164]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$suffixes'))} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: (C {<basename>} {($ Id.VSub_Number '$0')})
                        ) <': no images to display in folder '> ($ Id.VSub_DollarName '$watch')
                      )
                    }
                  ]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [223 237]
        )
      ]
    )
    (C {<'/bin/echo'>} {<-n>} 
      {
        (DQ <'Displaying '> 
          (command_sub
            left_token: <Id.Left_DollarParen '$('>
            child: 
              (command.Pipeline
                children: [(C {<ls>} {($ Id.VSub_DollarName '$suffixes')}) (C {<wc>} {<-l>})]
                negated: F
              )
          ) <' images from '> ($ Id.VSub_DollarName '$watch') <' '>
        )
      }
    )
    (command.CommandList
      children: [
        (command.Sentence child:(C {<set>} {<-f>}) terminator:<Id.Op_Semi _>)
        (command.Sentence
          child: (C {<echo>} {<with>} {<suffixes>} {($ Id.VSub_DollarName '$suffixes')})
          terminator: <Id.Op_Semi _>
        )
        (C {<set>} {<Id.Lit_Other '+'> <f>})
      ]
    )
    (C {<display>} {<-loop>} {<0>} {<-delay>} {($ Id.VSub_DollarName '$delay')} {<-resize>} 
      {($ Id.VSub_DollarName '$psize')} {<-backdrop>} {($ Id.VSub_DollarName '$suffixes')}
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)