(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TOOLPATH)
          op: assign_op.Equal
          rhs: {</sbin>}
          spids: [18]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DISKCOMMAND)
          op: assign_op.Equal
          rhs: {<sgdisk>}
          spids: [24]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:ZAPFLAGS)
          op: assign_op.Equal
          rhs: {(DQ <-Zog>)}
          spids: [30]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GUARDFILE)
          op: assign_op.Equal
          rhs: {</etc/ceph-disks-zapped>}
          spids: [35]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.Pipeline
                  children: [
                    (command.Simple
                      words: [{<dpkg>} {<-s>} {<gdisk>}]
                      redirects: [(redir.Redir op:<Id.Redir_Great '2>'> fd:2 arg_word:{</dev/null>})]
                    )
                    (C {<grep>} {<-q>} {<Status.> <Id.Lit_Star '*'> <installed>})
                  ]
                  negated: F
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [(C {<echo>} {(DQ <'gdisk is installed'>)})]
          spids: [39 61]
        )
      ]
      else_action: [
        (C {<echo>} {(DQ <'install gdisk...'>)})
        (C {<apt-get>} {<install>} {<--allow-unauthenticated>} {<-y>} {<gdisk>})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_z
                      child: 
                        {
                          (command_sub
                            left_token: <Id.Left_Backtick '`'>
                            command_list: 
                              (command.CommandList
                                children: [(C {<which>} {($ Id.VSub_DollarName '$DISKCOMMAND')})]
                              )
                          )
                        }
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (C {<echo>} {(DQ <"can't find '"> ($ Id.VSub_DollarName '$DISKCOMMAND') <"'">)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
          spids: [92 109]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: 
                        (bool_expr.Unary
                          op_id: Id.BoolUnary_f
                          child: {($ Id.VSub_DollarName '$GUARDFILE')}
                        )
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:mounted_whole_disks)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {<df>} {<-kh>})
                                  (C {<cut>} {<-f>} {<1>} {<-d> (SQ <' '>)})
                                  (C {<tail>} {<-n> <Id.Lit_Other '+'> <2>})
                                  (C {<grep>} {(SQ <'^/dev/sd'>)})
                                  (C {<sed>} {(SQ <'s/[0-9]/|/'>)})
                                  (C {<sort>} {<-u>})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                  spids: [149]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:mounted_disk_regex)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.ForEach
                                iter_name: disk
                                iter_words: [{($ Id.VSub_DollarName '$mounted_whole_disks')}]
                                do_arg_iter: F
                                body: 
                                  (command.DoGroup
                                    children: [
                                      (command.Sentence
                                        child: (C {<echo>} {<-n>} {($ Id.VSub_DollarName '$disk')})
                                        terminator: <Id.Op_Semi _>
                                      )
                                    ]
                                  )
                              )
                            ]
                          )
                      )
                    }
                  spids: [204]
                )
              ]
            )
            (command.ForEach
              iter_name: disk
              iter_words: [
                {
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    command_list: 
                      (command.CommandList
                        children: [
                          (C {<ls>} {</dev/sd> <Id.Lit_LBracket '['> <a-z> <Id.Lit_RBracket ']'>})
                        ]
                      )
                  )
                }
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.Pipeline
                                  children: [
                                    (C {<echo>} {(DQ ($ Id.VSub_DollarName '$disk'))})
                                    (C {<egrep>} {<-q>} 
                                      {
                                        (DQ 
                                          (braced_var_sub
                                            token: <Id.VSub_Name mounted_disk_regex>
                                            suffix_op: 
                                              (suffix_op.Slice
                                                begin: (arith_expr.ArithWord w:{<Id.Lit_Digits 0>})
                                                length: 
                                                  (arith_expr.Unary
                                                    op_id: Id.Node_UnaryMinus
                                                    child: (arith_expr.ArithWord w:{<Id.Lit_Digits 1>})
                                                  )
                                              )
                                          )
                                        )
                                      }
                                    )
                                  ]
                                  negated: T
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                          action: [
                            (C {<echo>} 
                              {
                                (DQ <'#### Overwriting '> ($ Id.VSub_DollarName '$disk') <' with '> 
                                  ($ Id.VSub_DollarName '$DISKCOMMAND') <' '> ($ Id.VSub_DollarName '$ZAPFLAGS')
                                )
                              }
                            )
                            (C 
                              {($ Id.VSub_DollarName '$TOOLPATH') </> 
                                ($ Id.VSub_DollarName '$DISKCOMMAND')
                              } {($ Id.VSub_DollarName '$ZAPFLAGS')} {($ Id.VSub_DollarName '$disk')}
                            )
                          ]
                          spids: [248 276]
                        )
                      ]
                      else_action: [
                        (C {<echo>} 
                          {(DQ <'#### Skipping mounted disk '> ($ Id.VSub_DollarName '$disk'))}
                        )
                      ]
                    )
                  ]
                )
            )
          ]
          spids: [129 142]
        )
      ]
      else_action: [(C {<echo>} {(DQ <'disks look zapped already'>)})]
    )
    (C {<touch>} {</etc/ceph-disks-zapped>})
  ]
)