Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a bash script that will determine if a file type is a directory, a symbolic link, or something else. Requirements for your script: Name

image text in transcribed
image text in transcribed
Write a bash script that will determine if a file type is a directory, a symbolic link, or something else. Requirements for your script: Name your script 04.sh Your script should use one parameter, $1, which will be a the name of a file, directory, hard link, symbolic link, etc., i.e. a name in the output of a Is command Your script should ensure there was a parameter provided when the script was ran. If not, a usage message should be output and the script terminated with an exit code of 1 Your script should use an if-elif-else command The if condition should test if the parameter is a directory, and output this message if true (parameter should be the value of the parameter provided when the script was ran): parameter is a directory The elif condition should test if the parameter is a symbolic link, and output this message if true: parameter is a link The else path should output this message: parameter is something else If you wish to test your script, you will need to create a file, symbolic link, and a directory Run these commands in the same directory as your script to create those: mkdir 04dir touch 04 file Focus Name your script 04.sh Your script should use one parameter, $1, which will be a the name of a file, directory, hard link, symbolic link, etc., i.e. a name in the output of a Is command Your script should ensure there was a parameter provided when the script was ran. If not, a usage message should be output and the script terminated with an exit code of 1 Your script should use an if-elif-else command The if condition should test if the parameter is a directory, and output this message if true (parameter should be the value of the parameter provided when the script was ran): parameter is a directory The elif condition should test if the parameter is a symbolic link, and output this message if true: parameter is a link The else path should output this message: parameter is something else If you wish to test your script, you will need to create a file, symbolic link, and a directory. Run these commands in the same directory as your script to create those: mkdix 04dir touch 04 file In -3 04file 04link

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions