Première version pour test
This commit is contained in:
		
							
								
								
									
										30
									
								
								sisr1/tp04_scripts_admin/Users.csv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								sisr1/tp04_scripts_admin/Users.csv
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					Ermengarde,Berthelmot,eberthelmot0@webmd.com,Female,Accountant,
 | 
				
			||||||
 | 
					Kassi,Bunker,kbunker1@xinhuanet.com,Female,Production,
 | 
				
			||||||
 | 
					Moises,McCallum,mmccallum2@i2i.jp,Male,Production,
 | 
				
			||||||
 | 
					Patrizio,Lune,plune3@upenn.edu,Male,Accountant,
 | 
				
			||||||
 | 
					Blanch,Everix,beverix4@php.net,Female,Accountant,
 | 
				
			||||||
 | 
					Stafani,Kibbel,skibbel5@marriott.com,Female,Production,
 | 
				
			||||||
 | 
					Ignacius,Mosdell,imosdell6@cloudflare.com,Male,Management,
 | 
				
			||||||
 | 
					Jeana,Waller-Bridge,jwallerbridge7@mapy.cz,Female,Management,
 | 
				
			||||||
 | 
					Elroy,Dressel,edressel8@opera.com,Male,Production,
 | 
				
			||||||
 | 
					Thea,Strettell,tstrettell9@nature.com,Female,Production,
 | 
				
			||||||
 | 
					Solomon,Insoll,sinsolla@utexas.edu,Male,Accountant,
 | 
				
			||||||
 | 
					Carri,Feedome,cfeedomeb@ask.com,Female,Accountant,
 | 
				
			||||||
 | 
					Padraic,Chetwind,pchetwindc@last.fm,Male,Management,
 | 
				
			||||||
 | 
					Solly,D'Ugo,sdugod@uiuc.edu,Male,Production,
 | 
				
			||||||
 | 
					Konstanze,MacCostigan,kmaccostigane@seattletimes.com,Female,Accountant,
 | 
				
			||||||
 | 
					Roxane,Powlesland,rpowleslandf@pcworld.com,Female,Management,
 | 
				
			||||||
 | 
					Orelle,Kennealy,okennealyg@arstechnica.com,Female,Production,
 | 
				
			||||||
 | 
					Sukey,Soitoux,ssoitouxh@shinystat.com,Female,Production,
 | 
				
			||||||
 | 
					Nelli,Syce,nsycei@blogger.com,Female,Production,
 | 
				
			||||||
 | 
					Clarisse,Shillam,cshillamj@dailymotion.com,Female,Production,
 | 
				
			||||||
 | 
					Carin,Gueny,cguenyk@naver.com,Female,Management,
 | 
				
			||||||
 | 
					Donny,Riepel,driepell@addtoany.com,Male,Production,
 | 
				
			||||||
 | 
					Daniella,Ralfe,dralfem@wunderground.com,Female,Production,
 | 
				
			||||||
 | 
					Lexy,Clynmans,lclynmansn@furl.net,Female,Production,
 | 
				
			||||||
 | 
					Gardiner,Adamthwaite,gadamthwaiteo@spotify.com,Male,Production,
 | 
				
			||||||
 | 
					Woodman,Lippett,wlippettp@purevolume.com,Male,Production,
 | 
				
			||||||
 | 
					Nadya,Munnion,nmunnionq@flavors.me,Female,Production,
 | 
				
			||||||
 | 
					Llewellyn,Habershon,lhabershonr@alibaba.com,Male,Production,
 | 
				
			||||||
 | 
					Isaak,Greatrex,igreatrexs@seesaa.net,Male,Production,
 | 
				
			||||||
 | 
					Darill,Frostdyke,dfrostdyket@cafepress.com,Male,Production,
 | 
				
			||||||
		
		
			
  | 
							
								
								
									
										30
									
								
								sisr1/tp04_scripts_admin/createGroups.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								sisr1/tp04_scripts_admin/createGroups.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					file='./Users.csv'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while read ligne
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
					    # A chaque itération, stocker le métier dans $metier
 | 
				
			||||||
 | 
					    metier=$(echo $ligne | cut -d "," -f5)
 | 
				
			||||||
 | 
					    # Vérification de la présence du groupe Accountant -> ajout de la fonction "Accountant" à $groups
 | 
				
			||||||
 | 
					    if [[ $(echo $line | grep "Accountant") != "" ]] ; then
 | 
				
			||||||
 | 
					        echo "Le groupe est déjà créé"
 | 
				
			||||||
 | 
					    else ;
 | 
				
			||||||
 | 
					        groupadd accountant
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Vérification de la présence du groupe Management -> ajout de la fonction "Management" à $groups
 | 
				
			||||||
 | 
					    if [[ $(echo $line | grep "Management") != "" ]] ; then
 | 
				
			||||||
 | 
					        echo "Le groupe est déjà créé"
 | 
				
			||||||
 | 
					    else ;
 | 
				
			||||||
 | 
					        groupadd management
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Vérification de la présence du groupe Production -> ajout de la fonction "Production" à $groups
 | 
				
			||||||
 | 
					    if [[ $(echo $line | grep "Production") != "" ]] ; then
 | 
				
			||||||
 | 
					        echo "Le groupe est déjà créé"
 | 
				
			||||||
 | 
					    else ;
 | 
				
			||||||
 | 
					        groupadd production
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    echo $metier
 | 
				
			||||||
 | 
					done < $file
 | 
				
			||||||
		Reference in New Issue
	
	Block a user