Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: The purpose of this assignment is to write a shell script with the name lab 4 . scr that will run various UNIX commands

Purpose: The purpose of this assignment is to write a shell
script with the name lab4.scr that will run various UNIX
commands and will redirect the output of the commands to
two output files with the filenames lab4out1 and lab4out2.
Note: The output files lab4out1 and lab4out2 must be passed
to the script as command line arguments. There should be no
reference to the filenames lab4out1 or lab4out2 in your script.
* Steps 1-5 listed below should be part of the lab4.scr script file.
* All files must be contained within your lab4 directory.
* Your script must contain comments with your name, course
number and your user id.
Create a directory with the name lab4 in your home directory
demonstrating use of the Keyword Shell Variable that contains the
value of your home directory.
Declare the local variable lab4_dir with the value of the pathname
to your lab4 directory. Declare the GLOBAL variable LAB4_DIR2 with
the value of the pathname to your lab4 directory.
Output file lab4out1 should contain the output
from the following Unix commands:
* List all filenames in the /home/david/lab4
directory beginning with "host" that were created
on May 24.
* Display the value of the shell variable that contains
the search path for executables.
* Declare the local variable lab4var with the value of the date in
the format mmddyy. Use the touch command to create the filename
lab4test in your lab4 directory using the lab4var variable as a
file extension. (i.e. lab4test.021520)
Output file lab4out2 should contain the output
from the following Unix commands:
* Copy the lab4.readme file from /home/david to your
lab4 directory using the lab4_dir variable. List
the file access permissions for all files in your
lab4 directory.
* List variables set in your environment displaying
ONLY the variable lab4_dir and its value.
* List all files in your lab4 directory using the GLOBAL
variable LAB4_DIR2.
Create a file in your lab4 directory with the filename lab4.out
that contains the contents of the lab4out1 and lab4out2 files.
can you give a detailed explanation and include screenshots?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions