Question: Lab Assignment 3 - 2 Shell Scripts Linux + and LPIC - 1 Show the complete script ( or commands ) and the resulting output

Lab Assignment 3-2 Shell Scripts Linux+ and LPIC-1
Show the complete script (or commands) and the resulting output for each question.
1. Modify the following script to insert descriptions of each of the commands.
#!/bin/bash
# This is the first example script
date
w
ls l
2. Write a script which will read the name of a directory and then create it as a sub directory in your home directory.
3. Complete the following scrpt:
#!/bin/bash
# This script lets the user choose to view the date, current users and processes, or the contents of the home directory
# Enter a choice
echo -e "What would you like to view:
Today's date -------------------------------->(d)
Current users and process ------------------->(u)
Contents of home directory ------------------>(h)
Enter choice d/u/h--------------------------->\c"
# Get the choice (complete this section)
# The decision construct to process the choice (complete this section)
# End of Script
4. Create a directory called Files in your home directory. In the Files directory create five files: Name, Address, State, Zip, and Phone. You can use touch to create the files.
5. Write a script file which will rename each of the files in directory Files (created in question 4) with a .txt extension. For example file Name will become Name.txt, etc.
6. Write a script called MakeFunction which creates a function named: CreateDir. The function when called should accept a new directory name as a command line argument and then create the new directory. Note: when executing MakeFunction used the dot command so that the function will be created in the login shell.

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 Programming Questions!