scripts
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,
 | 
			
		||||
		
		
			
  | 
							
								
								
									
										15
									
								
								sisr1/tp04_scripts_admin/createGroups.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								sisr1/tp04_scripts_admin/createGroups.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
fichier=./Users.csv     #Variable fichier qui stock le chemin du fichier
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
while read ligne      #définit la variable "ligne" comme le contenu de la ligne du fichier                en cours de lecture
 | 
			
		||||
do
 | 
			
		||||
  #a chaque iteration on rentre dans la variable metier on isole le champ 5 de la ligne.
 | 
			
		||||
  metier=$(echo $ligne | cut -d "," -f5)
 | 
			
		||||
  if [[ $(echo $user_line | grep $metier /etc/group) == "" ]] ; then
 | 
			
		||||
    groupadd $metier
 | 
			
		||||
  fi
 | 
			
		||||
  #on cherche metier dans le repertoire des groupe
 | 
			
		||||
  grep $metier /etc/group
 | 
			
		||||
  #on rentre les données du fichier avec done <
 | 
			
		||||
done < $fichier 
 | 
			
		||||
		Reference in New Issue
	
	Block a user