(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tid)
          op: Equal
          rhs: {(DQ ('pkcs11 agent test'))}
          spids: [7]
        )
      ]
      spids: [7]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:TEST_SSH_PIN) op:Equal rhs:{(DQ )} spids:[13])]
      spids: [13]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:TEST_SSH_PKCS11)
          op: Equal
          rhs: {(/usr/local/lib/soft-pkcs11.so.0.0)}
          spids: [17]
        )
      ]
      spids: [17]
    )
    (AndOr
      children: [
        (C {(test)} {(-f)} {(DQ ($ VSub_Name '$TEST_SSH_PKCS11'))})
        (C {(fatal)} {(DQ ($ VSub_Name '$TEST_SSH_PKCS11') (' does not exist'))})
      ]
      op_id: Op_DPipe
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:SOFTPKCS11RC)
          op: Equal
          rhs: {($ VSub_Name '$OBJ') (/pkcs11.info)}
          spids: [42]
        )
      ]
      spids: [42]
    )
    (C {(export)} {(SOFTPKCS11RC)})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:SSH_ASKPASS) op:Equal rhs:{(/usr/bin/true)} spids:[53])]
      spids: [53]
    )
    (C {(export)} {(SSH_ASKPASS)})
    (C {(unset)} {(DISPLAY)})
    (FuncDef
      name: notty
      body: 
        (BraceGroup
          children: [
            (C {(perl)} {(-e)} 
              {
                (SQ <'use POSIX; POSIX::setsid(); \n'> 
                  <'\t    if (fork) { wait; exit($? >> 8); } else { exec(@ARGV) }'>
                )
              } {(DQ ($ VSub_At '$@'))}
            )
          ]
          spids: [72]
        )
      spids: [68 71]
    )
    (C {(trace)} {(DQ ('start agent'))})
    (SimpleCommand
      words: [
        {(eval)}
        {
          (CommandSubPart
            command_list: (CommandList children:[(C {(${ VSub_Name SSHAGENT)} {(-s)})])
            left_token: <Left_Backtick '`'>
            spids: [99 105]
          )
        }
      ]
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[107])]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:r) op:Equal rhs:{($ VSub_QMark '$?')} spids:[111])]
      spids: [111]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_Name '$r')} {(-ne)} {(0)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(fail)} {(DQ ('could not start ssh-agent: exit code ') ($ VSub_Name '$r'))})]
          spids: [-1 127]
        )
      ]
      else_action: [
        (C {(trace)} {(DQ ('generating key/cert'))})
        (C {(rm)} {(-f)} {($ VSub_Name '$OBJ') (/pkcs11.key)} {($ VSub_Name '$OBJ') (/pkcs11.crt)})
        (SimpleCommand
          words: [{(openssl)} {(genrsa)} {(-out)} {($ VSub_Name '$OBJ') (/pkcs11.key)} {(2048)}]
          redirects: [
            (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[169])
            (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[173])
          ]
        )
        (C {(chmod)} {(600)} {($ VSub_Name '$OBJ') (/pkcs11.key)})
        (SimpleCommand
          words: [
            {(openssl)}
            {(req)}
            {(-key)}
            {($ VSub_Name '$OBJ') (/pkcs11.key)}
            {(-new)}
            {(-x509)}
            {(-out)}
            {($ VSub_Name '$OBJ') (/pkcs11.crt)}
            {(-text)}
            {(-subj)}
            {(SQ <'/CN=pkcs11 test'>)}
          ]
          redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[214])]
        )
        (SimpleCommand
          words: [
            {(printf)}
            {
              (DQ (a) (EscapedLiteralPart token:<Lit_EscapedChar '\\t'>) (a) 
                (EscapedLiteralPart token:<Lit_EscapedChar '\\t'>) ($ VSub_Name '$OBJ') (/pkcs11.crt) (EscapedLiteralPart token:<Lit_EscapedChar '\\t'>) 
                ($ VSub_Name '$OBJ') (/pkcs11.key)
              )
            }
          ]
          redirects: [
            (Redir
              op_id: Redir_Great
              fd: -1
              arg_word: {($ VSub_Name '$SOFTPKCS11RC')}
              spids: [233]
            )
          ]
        )
        (SimpleCommand
          words: [{(${ VSub_Name SSHKEYGEN)} {(-y)} {(-f)} {($ VSub_Name '$OBJ') (/pkcs11.key)}]
          redirects: [
            (Redir
              op_id: Redir_Great
              fd: -1
              arg_word: {($ VSub_Name '$OBJ') (/authorized_keys_) ($ VSub_Name '$USER')}
              spids: [253]
            )
          ]
        )
        (C {(trace)} {(DQ ('add pkcs11 key to agent'))})
        (Pipeline
          children: [
            (C {(echo)} {(${ VSub_Name TEST_SSH_PIN)})
            (SimpleCommand
              words: [{(notty)} {(${ VSub_Name SSHADD)} {(-s)} {(${ VSub_Name TEST_SSH_PKCS11)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[288])
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[292])
              ]
            )
          ]
          negated: False
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:r) op:Equal rhs:{($ VSub_QMark '$?')} spids:[296])]
          spids: [296]
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {($ VSub_Name '$r')} {(-ne)} {(0)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [(C {(fail)} {(DQ ('ssh-add -s failed: exit code ') ($ VSub_Name '$r'))})]
              spids: [-1 313]
            )
          ]
          spids: [-1 324]
        )
        (C {(trace)} {(DQ ('pkcs11 list via agent'))})
        (SimpleCommand
          words: [{(${ VSub_Name SSHADD)} {(-l)}]
          redirects: [
            (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[341])
            (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[345])
          ]
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:r) op:Equal rhs:{($ VSub_QMark '$?')} spids:[349])]
          spids: [349]
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {($ VSub_Name '$r')} {(-ne)} {(0)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [(C {(fail)} {(DQ ('ssh-add -l failed: exit code ') ($ VSub_Name '$r'))})]
              spids: [-1 366]
            )
          ]
          spids: [-1 377]
        )
        (C {(trace)} {(DQ ('pkcs11 connect via agent'))})
        (C {(${ VSub_Name SSH)} {(-2)} {(-F)} {($ VSub_Name '$OBJ') (/ssh_proxy)} {(somehost)} {(exit)} 
          {(5)}
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:r) op:Equal rhs:{($ VSub_QMark '$?')} spids:[406])]
          spids: [406]
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {($ VSub_Name '$r')} {(-ne)} {(5)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [(C {(fail)} {(DQ ('ssh connect failed (exit code ') ($ VSub_Name '$r') (')'))})]
              spids: [-1 423]
            )
          ]
          spids: [-1 435]
        )
        (C {(trace)} {(DQ ('remove pkcs11 keys'))})
        (Pipeline
          children: [
            (C {(echo)} {(${ VSub_Name TEST_SSH_PIN)})
            (SimpleCommand
              words: [{(notty)} {(${ VSub_Name SSHADD)} {(-e)} {(${ VSub_Name TEST_SSH_PKCS11)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[466])
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[470])
              ]
            )
          ]
          negated: False
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:r) op:Equal rhs:{($ VSub_QMark '$?')} spids:[474])]
          spids: [474]
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {($ VSub_Name '$r')} {(-ne)} {(0)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [(C {(fail)} {(DQ ('ssh-add -e failed: exit code ') ($ VSub_Name '$r'))})]
              spids: [-1 491]
            )
          ]
          spids: [-1 502]
        )
        (C {(trace)} {(DQ ('kill agent'))})
        (SimpleCommand
          words: [{(${ VSub_Name SSHAGENT)} {(-k)}]
          redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[519])]
        )
      ]
      spids: [137 523]
    )
  ]
)