(BraceGroup
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LANG)
          op: assign_op.Equal
          rhs: {<en_GB.UTF-8>}
          spids: [83]
        )
      ]
    )
    (C {<cd>} {(DQ ($ Id.VSub_DollarName '$HOME'))})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:INPUT)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [100]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_EqualTilde
                          left: {($ Id.VSub_Number '$1')}
                          right: 
                            {<Id.Lit_Other '^'> <-> <Id.Lit_Other '?'> <Id.Lit_Other '['> <0-9> 
                              <Id.Lit_Other ']'> <Id.Lit_Other '+'> <Id.Lit_Other '$'>
                            }
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:INPUT)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [128]
                )
              ]
            )
          ]
          spids: [105 125]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:FILEPATH_DIETPI_RAMLOG_SAVE)
          op: assign_op.Equal
          rhs: {(SQ <'/var/lib/dietpi/dietpi-ramlog/storage'>)}
          spids: [149]
        )
      ]
    )
    (command.ShFunction
      name: Apply_Unique_Logfile_Permissions
      body: 
        (BraceGroup
          children: [
            (C {<chown>} {<www-data> <Id.Lit_Colon ':'> <www-data>} {<'/var/log/pihole.log'>})
            (C {<chown>} {<-R>} {<mongodb> <Id.Lit_Colon ':'> <mongodb>} {<'/var/log/mongodb'>})
            (C {<chmod>} {<666>} {<'/var/log/emoncms.log'>})
            (C {<chown>} {<-R>} {<debian-tor> <Id.Lit_Colon ':'> <nogroup>} 
              {<'/var/log/tor/notices.log'>}
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DParen
                      child: 
                        (arith_expr.Binary
                          op_id: Id.Arith_DEqual
                          left: {($ Id.VSub_DollarName '$INPUT')}
                          right: {<Id.Lit_Digits 0>}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {<-e>} {(DQ <'DietPi-Ramlog: Starting'>)})
            (command.Simple
              words: [{<mkdir>} {<-p>} {<'/var/log/apt'>}]
              redirects: [
                (redir
                  op: <Id.Redir_AndGreat '&>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
              ]
              do_fork: T
            )
            (command.Simple
              words: [{<mkdir>} {<-p>} {<'/var/log/apache2'>}]
              redirects: [
                (redir
                  op: <Id.Redir_AndGreat '&>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
              ]
              do_fork: T
            )
            (command.Simple
              words: [{<mkdir>} {<-p>} {<'/var/log/fsck'>}]
              redirects: [
                (redir
                  op: <Id.Redir_AndGreat '&>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
              ]
              do_fork: T
            )
            (command.Simple
              words: [{<mkdir>} {<-p>} {<'/var/log/news'>}]
              redirects: [
                (redir
                  op: <Id.Redir_AndGreat '&>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
              ]
              do_fork: T
            )
            (command.Simple
              words: [{<mkdir>} {<-p>} {<'/var/log/samba'>}]
              redirects: [
                (redir
                  op: <Id.Redir_AndGreat '&>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
              ]
              do_fork: T
            )
            (command.Simple
              words: [{<mkdir>} {<-p>} {<'/var/log/ntpstats'>}]
              redirects: [
                (redir
                  op: <Id.Redir_AndGreat '&>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
              ]
              do_fork: T
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-d>} 
                              {(DQ ($ Id.VSub_DollarName '$FILEPATH_DIETPI_RAMLOG_SAVE'))} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<cp>} {<-R>} {<-p>} {<--attributes-only>} 
                      {(DQ ($ Id.VSub_DollarName '$FILEPATH_DIETPI_RAMLOG_SAVE')) <'/'> 
                        <Id.Lit_Star '*'>
                      } {<'/var/log/'>}
                    )
                  ]
                  spids: [360 373]
                )
              ]
            )
            (C {<chmod>} {<-R>} {<775>} {<'/var/log'>})
            (command.Simple
              words: [{<Apply_Unique_Logfile_Permissions>}]
              redirects: [
                (redir
                  op: <Id.Redir_AndGreat '&>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
              ]
              do_fork: T
            )
            (C {<echo>} {<-e>} {(DQ <'DietPi-Ramlog: Completed'>)})
          ]
          spids: [253 267]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DParen
                      child: 
                        (arith_expr.Binary
                          op_id: Id.Arith_DEqual
                          left: {($ Id.VSub_DollarName '$INPUT')}
                          right: {<Id.Lit_Digits 1>}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {<-e>} {(DQ <'DietPi-Ramlog: Stopping'>)})
            (C {<rm>} {<-R>} {(DQ ($ Id.VSub_DollarName '$FILEPATH_DIETPI_RAMLOG_SAVE'))})
            (C {<mkdir>} {<-p>} {(DQ ($ Id.VSub_DollarName '$FILEPATH_DIETPI_RAMLOG_SAVE'))})
            (C {<cp>} {<-R>} {<-p>} {<--attributes-only>} {<'/var/log/'> <Id.Lit_Star '*'>} 
              {(DQ ($ Id.VSub_DollarName '$FILEPATH_DIETPI_RAMLOG_SAVE')) <'/'>}
            )
            (C {<echo>} {<-e>} {(DQ <'DietPi-Ramlog: Completed'>)})
          ]
          spids: [437 451]
        )
      ]
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
  ]
)