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

Create shell scripts, .sh file. Please include a shebang line at the top of the script...
Create shell scripts, .sh file. Please include a shebang line at the top of the script as well as appropriate comments through out. Write a script that plays a simple “guess the number” game with the user. It should select a random integer in the range [0 - 10], ask the user to guess the value, and provide feedback of the form “too high”, “too low”, or “congratulations” as appropriate. After the correct value is guessed, the script should terminate.
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,...
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 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,...
this lab, you will write a shell script, called compare_cols.sh. This program should Read a CSV...
this lab, you will write a shell script, called compare_cols.sh. This program should Read a CSV file from standard input (STDIN). Note that in general, CSV files may contain quoted fields with embedded newlines. But for this assignment you can assume that there are no fields with embedded newlines, and therefore each new line represents a new row of the CSV file. Print a single number (integer) to standard output (STDOUT): the count of the lines in the CSV file...
Write bash shell scripts for the following problems and submit your answers a single. A )...
Write bash shell scripts for the following problems and submit your answers a single. A ) Write a linux bash shell script that reads your first and lastname as arguments and print them as shown below. In my example, I name the script as printname.sh. In the example, the two arguments follow the shell scriptname. Submit the script and output print screen. # sh ./printname.sh Abdullah Konak My first name is Abdullah My surname is Konak B ) Write a...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT