Question

In: Computer Science

I require some assistance with the following assignment as I belive I might be doing it...

I require some assistance with the following assignment as I belive I might be doing it wrong especially in step 2. Your assistance is much appreciated.

Linux Shell Scripting Practice:

Note: The following excercise requires the use of the nano text editor.

Begin by starting a script called “m5a2_part2b” by issuing the following at the command in a open terminal:

$ script m5a2_part2b

Step 1: Using the nano text editor, edit the following “Hello World” program, save as hello.sh, change its permission to executable, and then run the script to check your answer. Do it step-by-step.

In your open terminal type the following:

$ nano hello.sh
Enter the following three lines of code:

#!/bin/bash
clear
echo "Hello, World!"

Now

use CTRL X to exit out of nano.

Type chmod u+x hello.sh to make "hello.sh" executable.

Now type ./hello.sh to run the script. Take a screen shot.

Step 2: Write a “Hello World” program that has the same functionality as seen in Step 1 above, but use hello( ) function to achieve that. Do it again step-by-step.

In your open terminal, type the following:

$ nano vi hello.sh

Now enter the following three lines of code below:

#!/bin/bash
Hello() {
clear
echo "Hello, World!"
}

As before, use CTRL X to exit out of nano.

Type chmod u+x hello.sh to make "hello.sh" executable.

Now type ./hello.sh to run the script. Take a screen shot.

To exit the scipt simply type exit in your open terminal.

Solutions

Expert Solution

$ script m5a2_part2b

Step 1: Using the nano text editor, edit the following “Hello World” program, save as hello.sh, change its permission to executable, and then run the script to check your answer. Do it step-by-step.

In your open terminal type the following:

$ nano hello.sh


Enter the following three lines of code:

#!/bin/bash
clear
echo "Hello, World!"

Now

use CTRL X to exit out of nano.

Type chmod u+x hello.sh to make "hello.sh" executable.

Now type ./hello.sh to run the script. Take a screen shot.

Step 2: Write a “Hello World” program that has the same functionality as seen in Step 1 above, but use hello( ) function to achieve that. Do it again step-by-step.

In your open terminal, type the following:

$ nano vi hello.sh

  • Here the correct scirpt is "nano hello.sh" but it is written as "nano vi hello.sh"
  • vi is another text editor in Linux which is similar to nano

Now enter the following three lines of code below:

#!/bin/bash
Hello() {
clear
echo "Hello, World!"
}

Hello

As before, use CTRL X to exit out of nano.

Type chmod u+x hello.sh to make "hello.sh" executable.

Now type ./hello.sh to run the script. Take a screen shot.

To exit the scipt simply type exit in your open terminal.

  • You need to add Hello at the end to to call the function. If you don't aqdd this, the porogram will not run or will show emtpy output.

If you have any doubts, leave a comment below before rating. I'll be happy to assist you further.

Do UPVOTE this as I have put a lot of EFFORT in answering this question. It really helps me.


Related Solutions

I need assistance finding studies as references for an assignment. These are the parameters I require:...
I need assistance finding studies as references for an assignment. These are the parameters I require: Topic: PTSD as a result of trauma. PUBLISHED 2014 or after Peer reviewed study One author is a RN Study conducted NOT in the following countries: China, Middle East, Russia, India I need TWO of these types of studies. Thanks in advance!
I need some assistance with the following assignment: Cron is a system daemon running in the...
I need some assistance with the following assignment: Cron is a system daemon running in the background helping you schedule and execute tasks such as system backups. In this lab you will learn how to schedule backups with user and system cron tables. Submit a report that lists the commands that you would use to accomplish the following tasks: Check the status of a cron daemon Stop and terminate a cron daemon Start and run a cron daemon Restart a...
I require some assistance with the following problem: Create a binary search tree for 6 randomly...
I require some assistance with the following problem: Create a binary search tree for 6 randomly chosen vegetables. - Carrots - Green beans - Cucumber - Corn - Peas - Spinach Thank you.
1. When engaging with and motivating Nick, problems might arise that require assistance. Provide an example...
1. When engaging with and motivating Nick, problems might arise that require assistance. Provide an example of the type of problem that might occur that could be attributed to the impact of social devaluation and the social model of disability. 2. If a critical incident relating to adverse behaviour was to occur with Nick, how would you respond in accordance with his behavioural support plan and organisational policies and procedures? 3. In consultation with the supervisor, it has been agreed...
Hi i am doing an assignment on the financial crisis. I am up to the conclusion...
Hi i am doing an assignment on the financial crisis. I am up to the conclusion and i am having trouble writing it can you please write up a summary of the financial crisis. Thanks
Hello I need some assistance with these questions I need not so long answers but not...
Hello I need some assistance with these questions I need not so long answers but not too short please Give some examples of How much decisions. What are the implicit costs of having an Airbnb in your neighborhood? What is marginal analysis? What is marginal cost? Under what conditions do marginal costs increase?
Need some clarification on the following: I am currently working on an assignment with the following...
Need some clarification on the following: I am currently working on an assignment with the following question: - Identify the commands that are generally causing the highest load on your system and discuss your perspectives on why they cause such a load. Discuss your perspectives on the considerations system administration must give while using these commands. In my research, I can only find linux commands used to identify high loads on a linux system, but as we can see the...
Hello I have these questions, Can I please get some assistance, I need not so long...
Hello I have these questions, Can I please get some assistance, I need not so long or short answers please How to decide what job to take. Is that a marginal decision? What is an explicit cost? What is an implicit cost? How is accounting profit calculated? How is economic profit calculated?
Hello, I am in need of some assistance in interpreting the data for the two variables...
Hello, I am in need of some assistance in interpreting the data for the two variables I did in a t-test for in Excel. Variable 1 is Relationship with Direct Supervisor and Variable 2 is the Workplace Happiness Rating. I am supposed to write a 125- to 175-word summary of my interpretation of the results of the t test. t-Test: Two-Sample Assuming Equal Variances Variable 1 Variable 2 Mean 2.5 7.4 Variance 1.030612245 2 Observations 50 50 Pooled Variance 1.515306122...
Please I need assistance with this assignment- Select one of the United Nations' (U.N.) Millennial Development...
Please I need assistance with this assignment- Select one of the United Nations' (U.N.) Millennial Development Goals (MDGs). Visit the website and report on the UN's progress in achieving this goal? How will meeting this goal positively impact the health of the world? What suggestions would you make to help the UN achieve this goal? Please write from scratch, include citations and at least 3 references. Thank you
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT