I am trying to create a script with these options, create a user, leave a user, create a group , Drop the group. How to prevent all commands from running at one time?
#! / Usr / bin / perl $ opt = 0; & Amp; Disp_menu; $ Opt = & lt; & Gt ;; Print "You chose the option"; Print $ opt; $ User = `podo adousar maganen`; $ Group = `sudo group group group``; $ Dgroup = 'sudo groupdel Group1`; $ Duser = 'pseudo usurzedel mejenson'; Subdivision {print} "main menu \ n"; Print "option 1 group \ n"; Print "Option 2 Drop Group \ n"; Print "Option 3 Create User \ n"; Print "option 4 drop user \ n"; Print "option 5 exit menu \ n"; Print "option> & gt;"; Return;} if ($ opt == 3) {print "$ user"; } Elsf ($ opt == 1) {print "$ group \ n"; } Elsf ($ opt == 2) {print "$ dgroup \ n"; } Elsf ($ opt == 4) {print "$ duser \ n"; } Elsf ($ opt == 5) {print "You have exited the program"; }
#! / Usr / bin / perl $ opt = 0; & Amp; Disp_menu; $ Opt = & lt; & Gt ;; Print "You chose the option"; Print $ opt; If ($ opt == 3) {$ user = 'Pseudo Axur Mejenson'; If ($ ?! = -1) {print "User Mejenson has been created \ n"; }} Elsf ($ opt == 1) {$ group = 'Asdu Group Group Group 1`; If ($ ?! = -1) {Print "Group Group 1 has been created \ n"; }} Elsf ($ opt == 2) {$ dgroup = 'sudo group group group 1`; If ($ ?! = -1) {print "Group Group 1 has been removed \ n"; }} Elephant ($ opt == 4) {$ duser = 'Pseudo User Mejenson'; If ($ ?! = -1) {print "User Mejasen has been removed \ n"; }} Elsf ($ opt == 5) {print "You have exited the program"; } Sub Dipmenmen {Print "Main Menu \ n"; Print "option 1 group \ n"; Print "Option 2 Drop Group \ n"; Print "Option 3 Create User \ n"; Print "option 4 drop user \ n"; Print "option 5 exit menu \ n"; Print "option> & gt;"; Return; }
No comments:
Post a Comment