In: Computer Science
***************************************************** * USE UBUNTU (Linux) TERMINAL MODE COMMANDS ONLY * * DO NOT USE ANY EDITORS TO CREATE THIS PROGRAM * ***************************************************** 1) Create a file called lastNameFirstNameInitialpgm3.sh ex: robinsonMpgm1.sh 2) Append to the above file the necessary commands that when this file is executed it will display the following: - Using your own set of multi-line comments enter your program identification as described in the Syllabus, example: <<ID ************************************************** Author : Your Name Course : Course Name and Times Professor: Michael Robinson Program : Program Number, Purpose/Description A brief description of the program Due Date : mm/dd/yyyy I certify that this work is my own alone. ************************************************** ID - Append to the file the following commands that when this file is executed it will do the following: 1) Display Hello my name is: 2) Display My user name is: 3) Display Todays date and time is: 4) Display This file has x lines 5) Display This file has x words 6) Display this file has x bytes 7) Display Please enter any number 8) Display Your number $number * 2 = XXX and display press any key to continue 9) Display a new clean screen 10) Display Enter a line of numbers to be added 11) Using enhanced for loop, display all numbers entered delaying the output of each number by 1 second each and then the total of adding thoses numbers: ex: 20 5 3 = 28 12) Using a while true loop request, accept and display data until it ends on input mod 5 = 0 using -lt and -gt comparison commands this uses if else
Code:
#******************************************
#Author: Tom Cruise
#Course: CSE123
#Professor: Charles Babbage
#Program: Program Number, To display some text to the screen,
# and do some interactive programming.
#Due Date: 20/03/2017
#I certify that this work is my own alone.
#*****************************************
#ID
#Declare variable
num = 0
#Declare variable
num3=0
#Display message
echo 'Hello my name is: XXX'
#Display message
echo 'My user name is: $USER'
#Display message
echo 'Todays data and time is:' $(date)
#Display message
echo 'This file has' $(wc -l < $0) 'lines'
#Display message
echo 'This file has' $(wc -w < $0) 'words'
#Display message
echo 'This file has' $(wc -c < $0) 'bytes'
#Display message
echo 'Please enter any number'
#Read number
read num
#Display number
echo "Your number = $((num * 2))"
#If count matches
if [ $# -ne 2 ]
then
#Display message
echo "Usage - $0 x y"
#Display message
echo " Sum "
#Exit
exit 1
fi
#Display message
echo "Sum of $1 and $2 is `expr $1 + $2`"