I require some assistance with the following assignment as Ibelive I might be doing it wrong especially in step 2. Yourassistance is much appreciated.
Linux Shell Scripting Practice:
Note: The following excercise requires the use of the nano texteditor.
Begin by starting a script called “m5a2_part2b” by issuing thefollowing at the command in a open terminal:
$ script m5a2_part2b
Step 1: Using the nano text editor, edit thefollowing “Hello World” program, save as hello.sh, change itspermission to executable, and then run the script to check youranswer. 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 ascreen shot.
Step 2: Write a “Hello World” program that hasthe 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 ascreen shot.
To exit the scipt simply type exit in your open terminal.