Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need to create a script file called file_ops.sh and I am using gedit in Linux. There are supposed to be 4 if then statements
I need to create a script file called file_ops.sh and I am using gedit in Linux. There are supposed to be 4 if then statements they are supposed to look like this: if [ operator $! ] then echo message fi One is supposed to show the file exists and is a file, the 2nd is to show the file exists, 3rd the file does not exist and the 4th the file exists and is a directory. The picture shows what the output should look like but I cant get it to work.
(labuser@ SEC-335-VM scripting_lab] $ sh file_ops.sh /etc/passwd /etc/passwd exists and is a file /etc/passwd exists [labuser@SEC-335-VM scripting_lab] $ sh file_ops.sh /etc/passwdd /etc/passwdd does not exist [labuser@SEC-335-VM scripting_lab]$ sh file_ops.sh /etc /etc exists etc exists and is a directory [labuser@SEC-335-VM scripting_lab] $ sh file_ops.sh /etcc /etcc does not exist [labuser@SEC-335-VM scripting_lab]$ ||Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started