Skip to content

Latest commit

 

History

History

practise

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Programs for practise

Write scripts for following programs yourself, if you are not able to solve them you can contact Utrains for have some help.

Program 1

Write a shell script that prints "This script will return an exit status 200" and make sure that the script does return with an exit status 200.

Program 2

Write a shell script that accepts the absolute path to a file or directory as an argument, and if that file/dir exists, it returns with 0 exit status. Else, it makes creates that directory and then return with code 1.

Program 3

Write a script that executes the command "cat /etc/shadow". If the command returns a 0 exit status report "Command Executed!" and exit with a 0 exit status. If the command returns a non­zero exit status report "Command Not Executed!" and exit with a 1 exit status.

Program 4

Write a function in shell script to take a path as arguement and print the number of files/directories in that path.

Hint You can try copying the output of ls command in a text file and then count the number of lines in that file.