System AdministrationShell Scripts: exercises sheet 2Exercise 1 :Write a shell script that displays the contents of the directories existing in a directory given asargument (use the for loop)Exercice 2 :Write a shell script that displays the contents of subdirectories of the directories that are given asarguments. The script should be called with any number of parameters.Exercice 3 :Write a shell script that displays the nthline of a file(you can use head and tail). The integer n andthe input file name are given by the user in response to the request of the script (use the commandread). Try to do all possible tests (file exists or not etc ...)Exercise 4 :Write a shell script that give a variable x the following content “School man women fish dog catsheep” and then print each word in a separate line on the screen (use the for loop).Exercise 5 :Propose a shell script that displays the number of files in the present working directory .
System Administration
Shell Scripts: exercises sheet 2
Exercise 1 :
Write a shell script that displays the contents of the directories existing in a directory given as
argument (use the for loop)
Exercice 2 :
Write a shell script that displays the contents of subdirectories of the directories that are given as
arguments. The script should be called with any number of parameters.
Exercice 3 :
Write a shell script that displays the n
th
line of a file(you can use head and tail). The integer n and
the input file name are given by the user in response to the request of the script (use the command
read). Try to do all possible tests (file exists or not etc ...)
Exercise 4 :
Write a shell script that give a variable x the following content “School man women fish dog cat
sheep” and then print each word in a separate line on the screen (use the for loop).
Exercise 5 :
Propose a shell script that displays the number of files in the present working directory .
Unlock instant AI solutions
Tap the button
to generate a solution