Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Shebang-Everything

Your unofficial guidebook to shell programming

Programs for practise-2

Write scripts for following programs yourself, if you are not able to solve them you can see the code.

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.

See the code here!

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.

See the code here!

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.

See the code here!

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.

See the code here!