Question

In: Computer Science

Create a shell script called (Main.sh). The script must call the following scripts (FileS.sh), (Work.sh), (Ether.sh),...


Create a shell script called (Main.sh). The script must call the following scripts (FileS.sh), (Work.sh), (Ether.sh), (Arch.sh) and (Buzz.sh). The first script Main.sh must have two subroutines.
The First Subroutine will display the following messages on the screen:
1-Display User login name, date and time.
2-Display System boot time.
3-Working path and Shell type
4-Display Home directory and number of files and directories in your Home.
5-Message describing briefly the requited tasks.

Solutions

Expert Solution

Please find below the solution to your question, also find the screenshot of the output which I got after running this code.
1. subroutine1 covers the all 5 points mentioned in the question
2. subroutine2 calling to other scripts(correct the file path as per your file location)

#!/bin/sh
subroutine1()
{
        #echo "Arg 1: $1"
        echo "user Login Name : $(echo $USER)"
        echo "Current date and time : $(date)"
        echo "System Boot Time:" 
        who -b
        echo "Current Working Path:"; pwd
        echo "Shell Type:" $SHELL
        echo "*******************************************"
        echo "Home Directroy:" $HOME
        echo "Number of files and directories in home:"
        #sudo apt install tree ( if you haven't already installed in your system)
        tree $HOME | tail -1
       echo "*******************************************"
}
subroutine2()
{
        echo "inside subroutine2"
    #correct the file path as per your file location.
        /home/abhishek/Downloads/FileS.sh
        /path/to/files/Work.sh
        /path/to/files/Ether.sh
        /path/to/files/Arch.sh
        /path/to/files/Buzz.sh
}
subroutine1 
subroutine2


output:
(I havent specify the file path therfore in screenshot you are seeing error file not found) but It is worked fine for FileS.sh as I have mentioned It's path in the script.


Related Solutions

Using Python create a script called create_notes_drs.py. In the file, define and call a function called...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called main that does the following: Creates a directory called CyberSecurity-Notes in the current working directory Within the CyberSecurity-Notes directory, creates 24 sub-directories (sub-folders), called Week 1, Week 2, Week 3, and so on until up through Week 24 Within each week directory, create 3 sub-directories, called Day 1, Day 2, and Day 3 Bonus Challenge: Add a conditional statement to abort the script if...
In this lab, you will learn how to create shell scripts using the Bourne Shell Scripting...
In this lab, you will learn how to create shell scripts using the Bourne Shell Scripting language. The student will have to do research on the Bourne Shell Scripting language and then writ a script that asks the First Name , Last Name, Age, and Country of origin of the student and then print out these items in a statement Then the students will write a 3 to 4-page paper (not including the title and references pages) describing how the...
Write a shell script (to run on the Bourne shell) called cp2.sh to copy all the...
Write a shell script (to run on the Bourne shell) called cp2.sh to copy all the files from two named directories into a new third directory. Timestamps must be preserved while copying files from one directory into another. Task Requirements Three directory names must be supplied as arguments to your script when it is executed by the user. In the beginning of your script you need to check that the first two directory names provided (e.g. dir1 and dir2) exist...
Create shell scripts, each in its own .sh file. Please include a shebang line at the...
Create shell scripts, each in its own .sh file. Please include a shebang line at the top of the script as well as appropriate comments through out. Write a script that reads sunspot data from data-shell/data/sunspot.txt and uses awk to print a list of the total number of sunspots for each year on record as well as the twelve monthly averages across the record. Note: "awk allows you to index arrays using strings, so as you traverse the data file,...
Please write a shell script called "myfilechecking" to determine whether a file belongs to one of...
Please write a shell script called "myfilechecking" to determine whether a file belongs to one of the following categories: A directory; A scrip file (readable and executable); An executable file (not readable but executable, such as a.out); A regular ascii file (only readable, such as a C source code file); The file cannot be recognized. Your script should display the corresponding information based on the category of the file; The file name should be provided along with your script invocation,...
Create shell in C which meets requirements below: 1. The shell must support the following internal commands:
Create shell in C which meets the requirements below:1. The shell must support the following internal commands:i.cd - Change the current default directory toIf the argument is not present, report the current directory. If the directory does not exist an appropriate errorshould be reported. This command should also change thePWD environment variable.ii. clr - Clear the screen.iii. dir - List the contents of directory. iv.environ - List all the environment strings.v. echo - Display on the display followed by a newline...
Please write shell scripts in Kali Linux to complete the following tasks. Task A - Take...
Please write shell scripts in Kali Linux to complete the following tasks. Task A - Take your UIN Write a script like below that reads and displays the MIDAS ID if the following requirements are satisfied: Only lower case letter [a-z] and numeric character[0-9] are allowed MIDAS ID must between 4 to 8 digits Test your script with the following examples: Your MIDAS ID in lower case Your MIDAS ID w.one upper case A string less than 4 digits A...
Dominion Consulting in Sydney needs a shell script (to run on the Bourne shell) to maintain...
Dominion Consulting in Sydney needs a shell script (to run on the Bourne shell) to maintain its employee records file, which contains the following information (fields) about each employee: telephone number (8 digits, first digit non-zero); family name (alphabetic characters); first name (alphabetic characters); department number (2 digits) and job title (alphabetic characters). This script should let users add, delete, search for, and display specific employee information. Task Requirements Create a text file named records containing the following records with...
Write a complete shell script that first asks the user to enter a URL. The script...
Write a complete shell script that first asks the user to enter a URL. The script should read the URL into a variable named url. The shell script should then retrieve the file associated with the URL by using the curl command. The output of the curl command should be redirected to a file named html_file. The shell script should then use the grep command to search the file named html_file for the word manhattan. Finally, the shell script should...
Examine the following shell script and describe its function line-by-line: #! /bin/bash #This script backs up...
Examine the following shell script and describe its function line-by-line: #! /bin/bash #This script backs up the Oracle DB rm -f /SAN/backup-oracle* if tar -zcvf /SAN/backup-oracle- 'date +%F'.tar.gz/oracledb/* then echo "Oracle backup completed on 'date'" >>/var/log/oraclelog else echo "Oracle backup failed on 'date'" >>/var/log/oraclelog mail -s ALERT [email protected] </var/log/oraclelog fi
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT