(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PATH='> name:PATH)
          op: assign_op.Equal
          rhs: {<'/bin'> <Id.Lit_Colon ':'> <'/usr/sbin'>}
          spids: [86]
        )
      ]
      redirects: []
    )
    (command.ShFunction
      name: accept_if_fully_qualified
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Case
              to_match: {($ Id.VSub_Number 1)}
              arms: [
                (case_arm
                  pat_list: [{<Id.Lit_Star '*'> <.> <Id.Lit_Star '*'>}]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'Hostname '> ($ Id.VSub_DollarName myhostname) 
                          <' OK: fully qualified as '> ($ Id.VSub_Number 1)
                        )
                      }
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<0>}
                    )
                  ]
                  spids: [110 113 131 -1]
                )
              ]
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: check_gethostbyname
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ForEach
              iter_names: [host]
              iterable: 
                (for_iter.Words
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<getent>} {<hosts>} {($ Id.VSub_Number 1)})
                              (C {<awk>} {(SQ <'{for (f=2; f <= NF; f++) print $f}'>)})
                            ]
                            negated: F
                            stderr_indices: []
                          )
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  ]
                )
              body: 
                (command.DoGroup
                  children: [(C {<accept_if_fully_qualified>} {($ Id.VSub_DollarName host)})]
                )
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: check_hosts_file
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ForEach
              iter_names: [entry]
              iterable: 
                (for_iter.Words
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<sed>} {<-e>} {(SQ <'s/#.*$//'>)} {<'/etc/hosts'>})
                              (C {<awk>} 
                                {(SQ <'/[ \t]'>) ($ Id.VSub_Number 1) 
                                  (SQ <'([ \t]|$)/ \\\n'> 
                                    <'\t\t\t{for (f=2; f <= NF; f++) print $f; exit}'>
                                  )
                                }
                              )
                            ]
                            negated: F
                            stderr_indices: []
                          )
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  ]
                )
              body: 
                (command.DoGroup
                  children: [(C {<accept_if_fully_qualified>} {($ Id.VSub_DollarName entry)})]
                )
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: check_dns
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ForEach
              iter_names: [host]
              iterable: 
                (for_iter.Words
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: 
                          (command.Pipeline
                            children: [
                              (command.Simple
                                words: [{<nslookup>} {($ Id.VSub_Number 1)}]
                                redirects: [
                                  (redir
                                    op: <Id.Redir_Great '2>'>
                                    loc: (redir_loc.Fd fd:2)
                                    arg: {<'/dev/null'>}
                                  )
                                ]
                                more_env: []
                                do_fork: T
                              )
                              (C {<awk>} {(SQ <'$1 == "Name:" || $1 == "Aliases:"{print $2}'>)})
                            ]
                            negated: F
                            stderr_indices: []
                          )
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  ]
                )
              body: 
                (command.DoGroup
                  children: [(C {<accept_if_fully_qualified>} {($ Id.VSub_DollarName host)})]
                )
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: check_nis
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ForEach
              iter_names: [hst]
              iterable: 
                (for_iter.Words
                  words: [
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<ypmatch>} {($ Id.VSub_Number 1)} {<hosts>})
                              (C {<awk>} {(SQ <'{for (f=2; f <= NF; f++) print $f}'>)})
                            ]
                            negated: F
                            stderr_indices: []
                          )
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  ]
                )
              body: 
                (command.DoGroup
                  children: [(C {<accept_if_fully_qualified>} {($ Id.VSub_DollarName hst)})]
                )
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: suggest_fix_and_exit
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'myhost='> name:myhost)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number 1)}
                  spids: [381]
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: 
                    (sh_lhs_expr.Name
                      left: <Id.Lit_VarLike 'suggested_domain='>
                      name: suggested_domain
                    )
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number 2)}
                  spids: [385]
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'fhe='> name:fhe)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number 3)}
                  spids: [389]
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'myipaddr='> name:myipaddr)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<getent>} {<hosts>} {($ Id.VSub_DollarName myhost)})
                              (C {<head>} {<-1>})
                              (C {<awk>} {(SQ <'{print $1}'>)})
                            ]
                            negated: F
                            stderr_indices: []
                          )
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  spids: [393]
                )
              ]
              redirects: []
            )
            (C {<set>} {<-->} {(SQ )} {(SQ )} {(SQ <'[ aliases ... ]'>)})
            (C {<set>} {<-->} 
              {
                (command_sub
                  left_token: <Id.Left_Backtick '`'>
                  child: 
                    (command.Simple
                      words: [
                        {<grep>}
                        {(DQ <'^'> ($ Id.VSub_DollarName myipaddr) <'[\t ]'>)}
                        {<'/etc/hosts'>}
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '2>'>
                          loc: (redir_loc.Fd fd:2)
                          arg: {<'/dev/null'>}
                        )
                      ]
                      more_env: []
                      do_fork: T
                    )
                  right: <Id.Backtick_Right '`'>
                )
              }
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'result='> name:result)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '?')}
                  spids: [462]
                )
              ]
              redirects: []
            )
            (C {<shift>} {<2>})
            (C {<echo>} {(DQ <'We recommend '> <Id.Lit_BadBackslash '\\'> <c>)})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(DQ <x> ($ Id.VSub_DollarName fhe))} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <xfiles>)} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} {(DQ <'listing files first for hosts in /etc/nsswitch.conf'>)})
                    (C {<echo>} {(DQ <'and then '> <Id.Lit_BadBackslash '\\'> <c>)})
                  ]
                  spids: [480 500]
                )
              ]
              else_action: []
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName result)} 
                              {<Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} {(DQ <'changing the /etc/hosts entry:'> <Id.Lit_BadBackslash '\\'> <n>)})
                    (C {<echo>} 
                      {
                        (DQ ($ Id.VSub_DollarName myipaddr) <' '> ($ Id.VSub_DollarName myhost) <' '> 
                          ($ Id.VSub_Star '*') <Id.Lit_BadBackslash '\\'> <n>
                        )
                      }
                    )
                    (C {<echo>} {(DQ <'to:'> <Id.Lit_BadBackslash '\\'> <n>)})
                  ]
                  spids: [522 536]
                )
              ]
              else_action: [
                (C {<echo>} {(DQ <'adding the /etc/hosts entry:'> <Id.Lit_BadBackslash '\\'> <n>)})
              ]
              redirects: []
            )
            (C {<echo>} 
              {
                (DQ ($ Id.VSub_DollarName myipaddr) <' '> ($ Id.VSub_DollarName myhost) <' '> 
                  ($ Id.VSub_DollarName myhost) <.> ($ Id.VSub_DollarName suggested_domain) <' '> ($ Id.VSub_Star '*')
                )
              }
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name: check_nis_domain
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'nisdomain='> name:nisdomain)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: (C {<domainname>})
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  spids: [624]
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'realdomain='> name:realdomain)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<echo>} {($ Id.VSub_DollarName nisdomain)})
                              (C {<sed>} {(SQ <'s/[^.]*\\.//'>)})
                            ]
                            negated: F
                            stderr_indices: []
                          )
                        right: <Id.Backtick_Right '`'>
                      )
                    }
                  spids: [632]
                )
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(DQ <x> ($ Id.VSub_DollarName realdomain))} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <x>)} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'Hostname '> ($ Id.VSub_Number 1) <' can be fully qualified using NIS'> 
                          ($ Id.VSub_Number 2) <' domain'>
                        )
                      }
                    )
                    (C {<echo>} {(DQ <'\t'> ($ Id.VSub_DollarName nisdomain))})
                    (C {<echo>} {(DQ <'resulting in the name'>)})
                    (C {<echo>} {(DQ <'\t'> ($ Id.VSub_Number 1) <.> ($ Id.VSub_DollarName realdomain))})
                    (C {<echo>} {(DQ <'but this is bad practice.'> <Id.Lit_BadBackslash '\\'> <n>)})
                    (C {<suggest_fix_and_exit>} {($ Id.VSub_Number 1)} 
                      {($ Id.VSub_DollarName realdomain)} {($ Id.VSub_Number 3)}
                    )
                  ]
                  spids: [652 672]
                )
              ]
              else_action: []
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'myhostname='> name:myhostname)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                child: (C {<hostname>})
                right: <Id.Backtick_Right '`'>
              )
            }
          spids: [771]
        )
      ]
      redirects: []
    )
    (C {<check_gethostbyname>} {($ Id.VSub_DollarName myhostname)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'hosts_line='> name:hosts_line)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                child: 
                  (C {<sed>} {<-n>} {<-e>} {(SQ <'s/^hosts:\\([^#]*\\).*/\\1/p'>)} 
                    {<'/etc/nsswitch.conf'>}
                  )
                right: <Id.Backtick_Right '`'>
              )
            }
          spids: [784]
        )
      ]
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'first_hosts_entry='> name:first_hosts_entry)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                child: 
                  (command.Pipeline
                    children: [
                      (C {<echo>} {($ Id.VSub_DollarName hosts_line)})
                      (C {<awk>} {(SQ <'{print $1}'>)})
                    ]
                    negated: F
                    stderr_indices: []
                  )
                right: <Id.Backtick_Right '`'>
              )
            }
          spids: [807]
        )
      ]
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'nis_domains='> name:nis_domains)
          op: assign_op.Equal
          rhs: {(DQ )}
          spids: [824]
        )
      ]
      redirects: []
    )
    (command.ForEach
      iter_names: [entry]
      iterable: (for_iter.Words words:[{($ Id.VSub_DollarName hosts_line)}])
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.VSub_DollarName entry)}
              arms: [
                (case_arm
                  pat_list: [{<files>}]
                  action: [(C {<check_hosts_file>} {($ Id.VSub_DollarName myhostname)})]
                  spids: [847 848 856 -1]
                )
                (case_arm
                  pat_list: [{<dns>}]
                  action: [(C {<check_dns>} {($ Id.VSub_DollarName myhostname)})]
                  spids: [859 860 868 -1]
                )
                (case_arm
                  pat_list: [{<nis>}]
                  action: [
                    (C {<check_nis>} {($ Id.VSub_DollarName myhostname)})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: 
                            (sh_lhs_expr.Name
                              left: <Id.Lit_VarLike 'nis_domains='>
                              name: nis_domains
                            )
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_DollarName nis_domains) <' nis'>)}
                          spids: [880]
                        )
                      ]
                      redirects: []
                    )
                  ]
                  spids: [871 872 887 -1]
                )
              ]
              redirects: []
            )
          ]
        )
      redirects: []
    )
    (command.ForEach
      iter_names: [entry]
      iterable: (for_iter.Words words:[{($ Id.VSub_DollarName nis_domains)}])
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.VSub_DollarName entry)}
              arms: [
                (case_arm
                  pat_list: [{<nis>}]
                  action: [
                    (C {<check_nis_domain>} {($ Id.VSub_DollarName myhostname)} {(DQ )} 
                      {($ Id.VSub_DollarName first_hosts_entry)}
                    )
                  ]
                  spids: [913 914 927 -1]
                )
              ]
              redirects: []
            )
          ]
        )
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'realdomain='> name:realdomain)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                child: 
                  (command.Simple
                    words: [{<awk>} {(SQ <'$1 ~ /^domain/ {print $2}'>)}]
                    redirects: [
                      (redir
                        op: <Id.Redir_Great '2>'>
                        loc: (redir_loc.Fd fd:2)
                        arg: {<'/dev/null'>}
                      )
                      (redir
                        op: <Id.Redir_Less '<'>
                        loc: (redir_loc.Fd fd:0)
                        arg: {<'/etc/resolv.conf'>}
                      )
                    ]
                    more_env: []
                    do_fork: T
                  )
                right: <Id.Backtick_Right '`'>
              )
            }
          spids: [935]
        )
      ]
      redirects: []
    )
    (command.Case
      to_match: {($ Id.VSub_DollarName realdomain)}
      arms: [
        (case_arm
          pat_list: [{<Id.Lit_Star '*'> <.> <Id.Lit_Star '*'>}]
          action: []
          spids: [959 962 969 -1]
        )
        (case_arm
          pat_list: [{<Id.Lit_Star '*'>}]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'realdomain='> name:realdomain)
                  op: assign_op.Equal
                  rhs: {(DQ <pick.some.domain>)}
                  spids: [975]
                )
              ]
              redirects: []
            )
          ]
          spids: [971 972 981 -1]
        )
      ]
      redirects: []
    )
    (C {<echo>} 
      {(DQ <'Hostname '> ($ Id.VSub_DollarName myhostname) <' could not be fully qualified.'>)}
    )
    (C {<suggest_fix_and_exit>} {($ Id.VSub_DollarName myhostname)} {($ Id.VSub_DollarName realdomain)} 
      {($ Id.VSub_DollarName first_hosts_entry)}
    )
  ]
)