(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:sendmail)
          op: assign_op.Equal
          rhs: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<which>} {<sendmail>}))}
          spids: [11]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:sitearchive)
          op: assign_op.Equal
          rhs: {(DQ <'/tmp/changetrack'>)}
          spids: [19]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tmpchanges)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$sitearchive') <'/changes.'> ($ Id.VSub_Dollar '$$'))}
          spids: [24]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:fromaddr)
          op: assign_op.Equal
          rhs: {(DQ <'webscraper@intuitive.com'>)}
          spids: [34]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:dirperm)
          op: assign_op.Equal
          rhs: {<755>}
          spids: [39]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:fileperm)
          op: assign_op.Equal
          rhs: {<644>}
          spids: [45]
        )
      ]
    )
    (C {<trap>} 
      {
        (DQ (command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<which>} {<rm>})) <' -f '> 
          ($ Id.VSub_DollarName '$tmpchanges')
        )
      } {<0>} {<1>} {<15>}
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-ne>} {<2>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ <'Usage: '> 
                    (command_sub
                      left_token: <Id.Left_DollarParen '$('>
                      child: (C {<basename>} {($ Id.VSub_Number '$0')})
                    ) <' url email'>
                  )
                }
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'  tip: to have changes displayed on screen, use email addr \'-\''>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [74 88]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-d>} 
                      {($ Id.VSub_DollarName '$sitearchive')} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.Pipeline
                              children: [(C {<mkdir>} {($ Id.VSub_DollarName '$sitearchive')})]
                              negated: T
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ 
                            (command_sub
                              left_token: <Id.Left_DollarParen '$('>
                              child: (C {<basename>} {($ Id.VSub_Number '$0')})
                            ) <' failed: couldn\'t create '> ($ Id.VSub_DollarName '$sitearchive') <.>
                          )
                        }
                      ]
                      redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                      do_fork: T
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [141 151]
                )
              ]
            )
            (C {<chmod>} {($ Id.VSub_DollarName '$dirperm')} {($ Id.VSub_DollarName '$sitearchive')})
          ]
          spids: [124 138]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} 
                      {
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.Pipeline
                                children: [(C {<echo>} {($ Id.VSub_Number '$1')}) (C {<cut>} {<-c1-5>})]
                                negated: F
                              )
                          )
                        )
                      } {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <'http:'>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(DQ <'Please use fully qualified URLs (e.g. start with \'http://\')'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [188 217]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:fname)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_Number '$1')})
                        (C {<sed>} {(SQ <'s/http:\\/\\///g'>)})
                        (C {<tr>} {(SQ <'/?&'>)} {(SQ <...>)})
                      ]
                      negated: F
                    )
                )
              )
            }
          spids: [237]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:baseurl)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [(C {<echo>} {($ Id.VSub_Number '$1')}) (C {<cut>} {<'-d/'>} {<-f1-3>})]
                      negated: F
                    )
                ) <'/'>
              )
            }
          spids: [266]
        )
      ]
    )
    (command.Pipeline
      children: [
        (C {<lynx>} {<-dump>} {(DQ ($ Id.VSub_Number '$1'))})
        (command.Simple
          words: [{<uniq>}]
          redirects: [
            (redir
              op: <Id.Redir_Great '>'>
              loc: (redir_loc.Fd fd:1)
              arg: {($ Id.VSub_DollarName '$sitearchive') <'/'> (${ Id.VSub_Name fname) <.new>}
            )
          ]
          do_fork: T
        )
      ]
      negated: F
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-f>} 
                      {
                        (DQ ($ Id.VSub_DollarName '$sitearchive') <'/'> ($ Id.VSub_DollarName '$fname'))
                      } {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<diff>}
                {($ Id.VSub_DollarName '$sitearchive') <'/'> ($ Id.VSub_DollarName '$fname')}
                {($ Id.VSub_DollarName '$sitearchive') <'/'> (${ Id.VSub_Name fname) <.new>}
              ]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {($ Id.VSub_DollarName '$tmpchanges')}
                )
              ]
              do_fork: T
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-s>} {($ Id.VSub_DollarName '$tmpchanges')} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'Status: Site '> ($ Id.VSub_Number '$1') 
                          <' has changed since our last check.'>
                        )
                      }
                    )
                  ]
                  spids: [358 370]
                )
              ]
              else_action: [
                (C {<echo>} 
                  {
                    (DQ <'Status: No changes for site '> ($ Id.VSub_Number '$1') <' since last check'>)
                  }
                )
                (C {<rm>} {<-f>} 
                  {($ Id.VSub_DollarName '$sitearchive') <'/'> (${ Id.VSub_Name fname) <.new>}
                )
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
              ]
            )
          ]
          spids: [317 333]
        )
      ]
      else_action: [
        (C {<echo>} 
          {
            (DQ <'Status: first visit to '> ($ Id.VSub_Number '$1') 
              <'. Copy archived for future analysis.'>
            )
          }
        )
        (C {<mv>} {($ Id.VSub_DollarName '$sitearchive') <'/'> (${ Id.VSub_Name fname) <.new>} 
          {($ Id.VSub_DollarName '$sitearchive') <'/'> ($ Id.VSub_DollarName '$fname')}
        )
        (C {<chmod>} {($ Id.VSub_DollarName '$fileperm')} 
          {($ Id.VSub_DollarName '$sitearchive') <'/'> ($ Id.VSub_DollarName '$fname')}
        )
        (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_Number '$2'))} 
                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <->)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Pipeline
              children: [
                (command.Subshell
                  child: 
                    (command.CommandList
                      children: [
                        (C {<echo>} {(DQ <'Content-type: text/html'>)})
                        (C {<echo>} 
                          {
                            (DQ <'From: '> ($ Id.VSub_DollarName '$fromaddr') 
                              <' (Web Site Change Tracker)'>
                            )
                          }
                        )
                        (C {<echo>} 
                          {(DQ <'Subject: Web Site '> ($ Id.VSub_Number '$1') <' Has Changed'>)}
                        )
                        (C {<echo>} {(DQ <'To: '> ($ Id.VSub_Number '$2'))})
                        (C {<echo>} {(DQ )})
                        (command.Pipeline
                          children: [
                            (C {<curl>} {<-s>} {<-dump>} {($ Id.VSub_Number '$1')})
                            (C {<sed>} {<-e>} 
                              {
                                (DQ <'s|src='> 
                                  (word_part.EscapedLiteral
                                    token: <Id.Lit_EscapedChar '\\"'>
                                  ) <'|SRC='> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$baseurl') 
                                  <'|gi'>
                                )
                              } {<-e>} 
                              {
                                (DQ <'s|href='> 
                                  (word_part.EscapedLiteral
                                    token: <Id.Lit_EscapedChar '\\"'>
                                  ) <'|HREF='> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) 
                                  ($ Id.VSub_DollarName '$baseurl') <'|gi'>
                                )
                              } {<-e>} {(DQ <'s|'> ($ Id.VSub_DollarName '$baseurl') <Id.Lit_BadBackslash '\\'> <'/http:|http:|g'>)}
                            )
                          ]
                          negated: F
                        )
                      ]
                    )
                )
                (C {($ Id.VSub_DollarName '$sendmail')} {<-t>})
              ]
              negated: F
            )
          ]
          spids: [471 490]
        )
      ]
      else_action: [
        (C {<diff>} {($ Id.VSub_DollarName '$sitearchive') <'/'> ($ Id.VSub_DollarName '$fname')} 
          {($ Id.VSub_DollarName '$sitearchive') <'/'> (${ Id.VSub_Name fname) <.new>}
        )
      ]
    )
    (C {<mv>} {($ Id.VSub_DollarName '$sitearchive') <'/'> (${ Id.VSub_Name fname) <.new>} 
      {($ Id.VSub_DollarName '$sitearchive') <'/'> ($ Id.VSub_DollarName '$fname')}
    )
    (C {<chmod>} {<755>} {($ Id.VSub_DollarName '$sitearchive') <'/'> ($ Id.VSub_DollarName '$fname')})
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)