(command.CommandList children: [ (command.Case to_match: {(DQ ($ Id.VSub_Pound '$#'))} arms: [ (case_arm pat_list: [{<3>}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:user) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [27] ) ] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:group) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [33] ) ] ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:home) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$3'))} spids: [39] ) ] ) ] spids: [24 25 45 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (command.Sentence child: (command.Simple words: [{<echo>} {(DQ <'Usage: adduser user group home-dir'>)}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [47 48 -1 64] ) ] ) (command.Case to_match: {(DQ (command_sub left_token:<Id.Left_Backtick '`'> child:(C {<id>})))} arms: [ (case_arm pat_list:[{(SQ <'uid=0('>) <Id.Lit_Star '*'>}] spids:[82 86 89 -1]) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (command.Sentence child: (command.Simple words: [{<echo>} {(DQ <'adduser: you must be root to add users'>)}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [91 92 -1 108] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:len) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<expr>} {(DQ ($ Id.VSub_DollarName '$user'))} {<Id.Lit_Colon ':'>} {(SQ <'[a-z][a-z0-9]*$'>)} ) ) } spids: [114] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$len'))} {<-eq>} {<0>} {<-o>} {(DQ ($ Id.VSub_DollarName '$len'))} {<-gt>} {<8>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.Simple words: [ {<echo>} {(DQ <'adduser: the user name must be alphanumeric and no longer than 8 characters'>)} ] 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: [131 155] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:len) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<expr>} {(DQ ($ Id.VSub_DollarName '$group'))} {<Id.Lit_Colon ':'>} {(SQ <'[a-z][a-z0-9]*$'>)} ) ) } spids: [176] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$len'))} {<-eq>} {<0>} {<-o>} {(DQ ($ Id.VSub_DollarName '$len'))} {<-gt>} {<8>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.Simple words: [ {<echo>} { (DQ <'adduser: the group name must be alphanumeric and no longer than 8 characters'> ) } ] 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: [193 217] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Simple words: [{<grep>} {(DQ <'^'> ($ Id.VSub_DollarName '$user') <':'>)} {<'/etc/passwd'>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) ] ) action: [ (command.Simple words: [ {<echo>} {(DQ <'adduser: user '> ($ Id.VSub_DollarName '$user') <' already exists'>)} ] 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: [241 256] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:gid) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<sed>} {<-e>} {(DQ <'/^'> ($ Id.VSub_DollarName '$group') <':/!d'>)} {<-e>} {(SQ <'s/^[^:]*:[^:]*:\\([^:]*\\):.*/\\1/'>)} {<'/etc/group'>} ) ) } spids: [278] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<expr>} {(DQ ($ Id.VSub_DollarName '$gid'))} {<Id.Lit_Colon ':'>} {(SQ <'[0-9]*$'>)} ) ) } {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.Simple words: [ {<echo>} {(DQ <'adduser: group '> ($ Id.VSub_DollarName '$group') <' does not exist'>)} ] 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: [307 333] ) ] ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:uid) op:assign_op.Equal rhs:{<10>} spids:[358])] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Simple words: [ {<grep>} {(DQ <'^[^:]*:[^:]*:'> ($ Id.VSub_DollarName '$uid') <':.*'>)} {<'/etc/passwd'>} ] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})] do_fork: T ) ] ) body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:uid) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<expr>} {($ Id.VSub_DollarName '$uid')} {<Id.Lit_Other '+'>} {<1>}) ) } spids: [379] ) ] ) ] ) ) (C {<trap>} {(SQ )} {<1>} {<2>} {<3>} {<15>}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<ln>} {<'/etc/passwd'>} {<'/etc/ptmp'>}) (BraceGroup children: [ (C {<echo>} {(DQ <'adduser: password file busy, try again later'>)}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<mkdir>} {(DQ ($ Id.VSub_DollarName '$home'))}) (BraceGroup children: [ (C {<rm>} {<-rf>} {<'/etc/ptmp'>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ] ) (C {<echo>} {<cpdir>} {<'/usr/ast'>} {(DQ ($ Id.VSub_DollarName '$home'))}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cpdir>} {<'/usr/ast'>} {(DQ ($ Id.VSub_DollarName '$home'))}) (BraceGroup children: [ (C {<rm>} {<-rf>} {<'/etc/ptmp'>} {(DQ ($ Id.VSub_DollarName '$home'))}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ] ) (C {<echo>} {<chown>} {<-R>} {($ Id.VSub_DollarName '$uid') <Id.Lit_Colon ':'> ($ Id.VSub_DollarName '$gid')} {(DQ ($ Id.VSub_DollarName '$home'))} ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<chown>} {<-R>} {($ Id.VSub_DollarName '$uid') <Id.Lit_Colon ':'> ($ Id.VSub_DollarName '$group')} {(DQ ($ Id.VSub_DollarName '$home'))} ) (BraceGroup children: [ (C {<rm>} {<-rf>} {<'/etc/ptmp'>} {(DQ ($ Id.VSub_DollarName '$home'))}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [(C {<Id.Lit_LBracket '['>} {<-f>} {<'/etc/shadow'>} {<Id.Lit_RBracket ']'>})] ) action: [ (C {<echo>} {(DQ <'echo '> ($ Id.VSub_DollarName '$user') <'::0:0::: >>/etc/shadow'>)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$user') <'::0:0:::'>)}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<'/etc/shadow'>} ) ] do_fork: T ) (BraceGroup children: [ (C {<rm>} {<-rf>} {<'/etc/ptmp'>} {(DQ ($ Id.VSub_DollarName '$home'))}) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pwd) op: assign_op.Equal rhs: {(DQ <'##'> ($ Id.VSub_DollarName '$user'))} spids: [626] ) ] ) ] spids: [570 580] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pwd) op: assign_op.Equal rhs: (word.Empty) spids: [635] ) ] ) ] ) (C {<echo>} { (DQ <'echo '> ($ Id.VSub_DollarName '$user') <':'> ($ Id.VSub_DollarName '$pwd') <':'> ($ Id.VSub_DollarName '$uid') <':'> ($ Id.VSub_DollarName '$gid') <':'> ($ Id.VSub_DollarName '$user') <':'> ($ Id.VSub_DollarName '$home') <': >>/etc/passwd'> ) } ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [ {<echo>} { (DQ ($ Id.VSub_DollarName '$user') <':'> ($ Id.VSub_DollarName '$pwd') <':'> ($ Id.VSub_DollarName '$uid') <':'> ($ Id.VSub_DollarName '$gid') <':'> ($ Id.VSub_DollarName '$user') <':'> ($ Id.VSub_DollarName '$home') <':'> ) } ] redirects: [(redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<'/etc/passwd'>})] do_fork: T ) (BraceGroup children: [ (C {<rm>} {<-rf>} {<'/etc/ptmp'>} {(DQ ($ Id.VSub_DollarName '$home'))}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [(C {<rm>} {<'/etc/ptmp'>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit>)] ) (C {<echo>} { (DQ <'\n'> <'The new user '> ($ Id.VSub_DollarName '$user') <' has been added to the system. Note that the password,\n'> <'full name, and shell may be changed with the commands passwd(1), chfn(1),\n'> <'and chsh(1). The password is now empty, so only console logins are possible.'> ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$gid')} {<Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (C {<echo>} { (DQ <'Also note that a new operator needs an executable search path ('> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'PATH) that\n'> <'does not contain the current directory (an empty field or '> ) <.> (DQ <' in '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'PATH).'>) } ) ] spids: [727 739] ) ] ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] )