(command.CommandList
  children: [
    (C {<export>} {<Id.Lit_VarLike 'CURL='> (SQ <curl>)})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName '$PROXY'))} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'Setting up and testing proxy'>)})
            (C {<export>} 
              {<Id.Lit_VarLike 'http_proxy='> <http> <Id.Lit_Colon ':'> <'//'> (${ Id.VSub_Name PROXY)}
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'https_proxy='> <https> <Id.Lit_Colon ':'> <'//'> (${ Id.VSub_Name PROXY)}
            )
            (C {<export>} {<Id.Lit_VarLike 'GIT_SSL_NO_VERIFY='> <true>})
            (C {<export>} {<Id.Lit_VarLike 'CURL='> (DQ <'curl -k -x http://'> (${ Id.VSub_Name PROXY))})
            (command.Simple
              words: [
                {($ Id.VSub_DollarName '$CURL')}
                {<-s>}
                {<--connect-timeout>}
                {<1>}
                {<http> <Id.Lit_Colon ':'> <'//www.ubuntu.com'>}
              ]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_GlobNEqual
                                  left: {($ Id.VSub_QMark '$?')}
                                  right: {<0>}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {(DQ <'Error: proxy '> ($ Id.VSub_DollarName '$PROXY') <' not responding'>)}
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [139 152]
                )
              ]
              else_action: [(C {<echo>} {(DQ <'Using a proxy at '> ($ Id.VSub_DollarName '$PROXY'))})]
            )
          ]
          spids: [45 58]
        )
      ]
      else_action: [
        (C {<echo>} 
          {
            (DQ (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) 
              <'PROXY not defined, not defining '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'http_proxy and '> 
              (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <https_proxy>
            )
          }
        )
      ]
    )
  ]
)