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.
Could i please have some assistance with the following questions. a) What is the purpose of...
Could i please have some assistance with the following questions. a) What is the purpose of port numbers? how are they used? b) Why does TCP probe the network continuously until it experiences a loss? c) What is the difference between the congestion window and the received window? d) What is the benefit of TCP Reno over TCP Tahoe?
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...
I need assistance on what I am doing wrong, I've been trying to declare "getRandomLetter" as...
I need assistance on what I am doing wrong, I've been trying to declare "getRandomLetter" as a scope, but haven't found how to all day. It's been about 3+ hours and I still have nothing. Please help fix these and let me know what I am doing wrong (There may be more simple ways of coding all this, but I just need help fixing the errors with current code, thank you). I am trying to have buildAcronym() hold the position...
Could i please have some assistance with the following questions. a) What are key features of...
Could i please have some assistance with the following questions. a) What are key features of UDP Services? b) What are some of the advantages of UDP compared to TCP? c) What is the aim of the connection setup Phase, ie, 3 way handshake, of TCP? d) What causes duplicate ACK's
Could i please have some assistance with the following questions. a) When using the exponential weighted...
Could i please have some assistance with the following questions. a) When using the exponential weighted moving average (EWMA) to calculate the running time of the RTT, what does the constant ‘x’ control? b) Consider a TCP segment. What is sequence number? What is the range of the sequence number? What is the acknowledge number (ACK)?
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?
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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT