Question: Linux-Bash Lab requires you to write a shell script program, svi and a result file, result. Deliverables Upload your script program file, svi Upload your

Linux-Bash Lab requires you to write a shell script program, svi and a result file, result.

Deliverables

Upload your script program file, svi

Upload your script run results file, result

Creating a Bash Script File

After you are satisfied with your hands-on log session in Lab Assignment 6-1, create and execute a bash script using a text editor of your choice that does the following:

Write a script file that makes use of positional variables. Suppose you want to write a script file that stores the specified file in a directory called keep in your HOME directory and then invokes the vi editor to edit the specified file. The commands to do this job are:

$ cp xyz $HOME/keep # Copy the specified file xyz to the directory keep

$ vi xyz # Invoke the vi editor

Your bash script program will do this job. The positional variables will make your bash script a versatile program. It saves any specified file passed to it in the keep directory, the vi editor is invoked, and you will be able to edit the xyz file.

Example:

$ ./svi xyz

Before you begin:

Create a file xyz with the following contents:

$ cat xyz

testing xyz

Create the directory keep in your lab6 directory:

$ mkdir keep

Write a script called svi that does the following:

Lists current date

Displays your username

Displays the file xyz contents

Copies the file xyz to the directory keep

Invokes the vi editor to edit the file

Displays the modified file xyz

Uses the ls command to show a copy of the xyz file is saved in the keep directory

Notes:

Display all standard output to the file, result.

Edit the file xyz by adding your name as the first word in the file.

Example:

$ cat xyz

testing xyz

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!