Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with my project for my UNIX/Linux class. I also have to demonstrate this to my professor. Project 1: sgen script creation utility

I need help with my project for my UNIX/Linux class. I also have to demonstrate this to my professor.

Project 1: sgen script creation utility

Part 1. Create a shell script called sgen that asks you for your name and then creates an output file called sgen.out in the current directory that contains the following 5 lines except with your name and the date and time plugged in:

#####################################

# This is a new sgen.out file.

# It was created by: --your name ends up here--

#Creation date and time: --the time and date end up here--

####################################

Part 2. Make a copy of your sgen program called sgen2. Modify sgen2 to do the following:

a. Instead of using "sgen.out" as an output file name, sgen2 asks you for a file name and uses that name for its output file (see below).

b. sgen2 asks you for your name and puts whatever you type in the output file along with the current date.

c. sgen2 generates an output file with the name you typed that includes the following 7 lines (except for the --notes--):

##########################################

# Script: --the name if this file, see part 2a--

# Author: --your name, see part 2b--

# Date: --the date you ran the script, see part 2b--

#########################################

echo Hello, world\!\!

echo I am the script $0

d. This output file is actually a Unix script. When you execute it, you should see this on the screen --

Hello, world!!

I am the script whatever_you_called-it

e. sgen2 checks to see if you don't give an output file name, in which case it displays the message "No script name" and stops, not generating the file. Likewise if you don't give it a value for your name, it should display "No name given" and stop. The sgen2 program should only generate its output file if you give both a file name and your name.

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_2

Step: 3

blur-text-image_3

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

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions