(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalOr
                      left: (bool_expr.Unary op_id:Id.BoolUnary_z child:{(DQ ($ Id.VSub_Number '$1'))})
                      right: 
                        (bool_expr.LogicalOr
                          left: 
                            (bool_expr.Unary
                              op_id: Id.BoolUnary_z
                              child: {(DQ ($ Id.VSub_Number '$2'))}
                            )
                          right: 
                            (bool_expr.Unary
                              op_id: Id.BoolUnary_z
                              child: {(DQ ($ Id.VSub_Number '$3'))}
                            )
                        )
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:NAME)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [(C {<basename>} {(DQ ($ Id.VSub_Number '$0'))})]
                          )
                      )
                    }
                  spids: [71]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobEqual
                              left: {(DQ ($ Id.VSub_DollarName '$NAME'))}
                              right: {<nodescp>}
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'Usage: '> ($ Id.VSub_Number '$0') 
                          <" 'environment' 'nodename|IP address' 'from' 'to'">
                        )
                      }
                    )
                  ]
                  spids: [81 96]
                )
              ]
              else_action: [
                (C {<echo>} 
                  {
                    (DQ <'Usage: '> ($ Id.VSub_Number '$0') 
                      <" 'environment' 'nodename|IP address' 'command' (sudo)">
                    )
                  }
                )
              ]
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
          spids: [39 68]
        )
      ]
    )
    (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>} {<sshpass>})])
                          )
                        }
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (C {<echo>} 
              {
                (DQ 
                  <
"Error: sshpass required for this tool. You should be able to 'sudo apt-get install sshpass' to get it"
                  >
                )
              }
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
          spids: [129 146]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:ENVIRONMENT)
          op: assign_op.Equal
          rhs: {($ Id.VSub_Number '$1')}
          spids: [161]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:IP)
          op: assign_op.Equal
          rhs: {($ Id.VSub_Number '$2')}
          spids: [164]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:COMMAND)
          op: assign_op.Equal
          rhs: {($ Id.VSub_Number '$3')}
          spids: [167]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:KNIFESTAT)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (command.Simple
                            words: [
                              {<knife>}
                              {<data>}
                              {<bag>}
                              {<show>}
                              {<configs>}
                              {($ Id.VSub_DollarName '$ENVIRONMENT')}
                            ]
                            redirects: [(redir.Redir op:<Id.Redir_GreatAnd '2>&'> fd:2 arg_word:{<1>})]
                          )
                          (C {<grep>} {<ERROR>})
                        ]
                        negated: F
                      )
                    ]
                  )
              )
            }
          spids: [174]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: 
                        (bool_expr.Unary
                          op_id: Id.BoolUnary_z
                          child: {(DQ ($ Id.VSub_DollarName '$KNIFESTAT'))}
                        )
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (C {<echo>} 
              {(DQ <'knife error '> ($ Id.VSub_DollarName '$KNIFESTAT') <' when showing the config'>)}
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
          spids: [200 215]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:PASSWD)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {<knife>} {<data>} {<bag>} {<show>} {<configs>} 
                            {($ Id.VSub_DollarName '$ENVIRONMENT')}
                          )
                          (C {<grep>} {(DQ <'cobbler-root-password:'>)})
                          (C {<awk>} {(SQ <' {print $2}'>)})
                        ]
                        negated: F
                      )
                    ]
                  )
              )
            }
          spids: [235]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_z
                      child: {(DQ ($ Id.VSub_DollarName '$PASSWD'))}
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (C {<echo>} {(DQ <"Failed to retrieve 'cobbler-root-password'">)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
          spids: [268 281]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobDEqual
                      left: 
                        {
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            command_list: 
                              (command.CommandList
                                children: [(C {<basename>} {(DQ ($ Id.VSub_Number '$0'))})]
                              )
                          )
                        }
                      right: {<nssh>}
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:SSH1COMMON)
                  op: assign_op.Equal
                  rhs: {(DQ )}
                  spids: [338]
                )
              ]
            )
          ]
          spids: [316 335]
        )
      ]
      else_action: [
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:SSHCOMMON)
              op: assign_op.Equal
              rhs: 
                {
                  (DQ 
                    <
'-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o VerifyHostKeyDNS=no'
                    >
                  )
                }
              spids: [345]
            )
          ]
        )
      ]
    )
    (command.ShFunction
      name: apply_command
      body: 
        (command.BraceGroup
          children: [
            (C {(DQ ($ Id.VSub_At '$@'))})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:RES)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [365]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_ne
                              left: {(DQ ($ Id.VSub_DollarName '$RES'))}
                              right: {<0>}
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} {(DQ <"Executing '"> ($ Id.VSub_At '$@') <"' failed">)})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {($ Id.VSub_DollarName '$RES')}
                    )
                  ]
                  spids: [369 384]
                )
              ]
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobDEqual
                      left: 
                        {
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            command_list: 
                              (command.CommandList
                                children: [(C {<basename>} {(DQ ($ Id.VSub_Number '$0'))})]
                              )
                          )
                        }
                      right: {<nodescp>}
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:SCPCMD)
                  op: assign_op.Equal
                  rhs: {(DQ <'scp '> ($ Id.VSub_DollarName '$SSHCOMMON'))}
                  spids: [428]
                )
              ]
            )
            (C {<apply_command>} {<sshpass>} {<-p>} {($ Id.VSub_DollarName '$PASSWD')} 
              {($ Id.VSub_DollarName '$SCPCMD')} {<-p>} {(DQ ($ Id.VSub_Number '$3'))} 
              {(DQ <'ubuntu@'> ($ Id.VSub_Number '$2') <':'> ($ Id.VSub_Number '$4'))}
            )
          ]
          spids: [406 425]
        )
      ]
      else_action: [
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:SSHCMD)
              op: assign_op.Equal
              rhs: {(DQ <'ssh '> ($ Id.VSub_DollarName '$SSHCOMMON'))}
              spids: [470]
            )
          ]
        )
        (command.If
          arms: [
            (if_arm
              cond: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: {(DQ ($ Id.VSub_Number '$4'))}
                          right: {<sudo>}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
              action: [
                (C {<apply_command>} {<sshpass>} {<-p>} {($ Id.VSub_DollarName '$PASSWD')} 
                  {($ Id.VSub_DollarName '$SSHCMD')} {<-t>} {<ubuntu> <Id.Lit_Other '@'> ($ Id.VSub_DollarName '$IP')} 
                  {
                    (DQ <'echo '> ($ Id.VSub_DollarName '$PASSWD') <' | sudo -S '> 
                      ($ Id.VSub_DollarName '$COMMAND')
                    )
                  }
                )
              ]
              spids: [478 493]
            )
          ]
          else_action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobDEqual
                              left: {(DQ ($ Id.VSub_DollarName '$COMMAND'))}
                              right: {<->}
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'You might need this : cobbler_root = '> ($ Id.VSub_DollarName '$PASSWD'))
                      }
                    )
                    (C {<apply_command>} {<sshpass>} {<-p>} {($ Id.VSub_DollarName '$PASSWD')} 
                      {($ Id.VSub_DollarName '$SSHCMD')} {<-t>} {<ubuntu> <Id.Lit_Other '@'> ($ Id.VSub_DollarName '$IP')}
                    )
                  ]
                  spids: [532 547]
                )
              ]
              else_action: [
                (C {<apply_command>} {<sshpass>} {<-p>} {($ Id.VSub_DollarName '$PASSWD')} 
                  {($ Id.VSub_DollarName '$SSHCMD')} {<-t>} {<ubuntu> <Id.Lit_Other '@'> ($ Id.VSub_DollarName '$IP')} 
                  {(DQ ($ Id.VSub_DollarName '$COMMAND'))}
                )
              ]
            )
          ]
        )
      ]
    )
  ]
)