Question: Shell Script to Create a new file Write a shell script using nano or vi editor ( eg , nano scriptname.sh ) like below, that
Shell Script to Create a new file
Write a shell script using nano or vi editor eg nano scriptname.sh like below, that
performs the following task:
Add the Shebang #binbash as the first line in your script.
Reads the name of the file to check for a filename that exists.
Check whether the given input is a directory or regular file. vi
If the input is a directory and exists, then display the message Directory exists
If the input is a regular file, then display the message It is a regular file, and the file
exists and display the contents of the file.
If the given input name in step doesnt exist, then create the new file with the given name in step
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
