Question

In: Computer Science

***************************************************** * USE UBUNTU (Linux) TERMINAL MODE COMMANDS ONLY * * DO NOT USE ANY EDITORS...

*****************************************************
   *   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 

Solutions

Expert Solution

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`"


Related Solutions

Linux Ubuntu 1. Use the appropriate commands to locate the device file used by the device,...
Linux Ubuntu 1. Use the appropriate commands to locate the device file used by the device, mount the filesystem to a directory of your choice, and check the filesystem for errors. 2. Finally, add a line to /etc/fstab to ensure that the filesystem can be easily mounted in the future (this line should not automount the filesystem at boot time). You have to document all your steps and provide the screenshot of your work process.
Given the Linux shell command descriptions, please write down the corresponding shell commands in a terminal...
Given the Linux shell command descriptions, please write down the corresponding shell commands in a terminal window.             a) list the current directory contents with the long format             b) print the name of the working directory             c) change directory to the root directory             d) change the permissions of file "myfile" (owned by yourself) so that (1)you can read/write, but cannot execute; (2) all other users cannot read/write/execute this file.             e) make a new directory called “mydir”
Part 1 - Java program named MemoryCalculator In your Ubuntu VM (virtual machine), using terminal mode...
Part 1 - Java program named MemoryCalculator In your Ubuntu VM (virtual machine), using terminal mode ONLY, do the following: Create the folder program2 Each record in this file represents the possible location of an error found in RAM. (Hint: One of them is not on one of the chips.) Assume you have a computer with 4 gigs of RAM, each gig in a different memory chip, therefore you have 4 one gig RAM chips. ---------decimal--------------- HINT: RAM chip 0...
Upgrade your UBUNTU Linux system and document the steps that you took. What events, if any,...
Upgrade your UBUNTU Linux system and document the steps that you took. What events, if any, were logged? Next, search the repositories for the application nginx. If it’s not installed, install it. Document the steps you took.
Try the Linux commands listed below. Post your thoughts about how to use these commands. Discuss...
Try the Linux commands listed below. Post your thoughts about how to use these commands. Discuss options that you might use with them, compare and contrast them and/or ask questions about commands you are not sure about. mount and umount more and less head and tail grep kill / xkill / pkill / killall su and sudo man and whatis ping and traceroute
Unix/Linux Turn in the following commands and any output from the commands. 1) ll to show the original 3 files
Unix/LinuxTurn in the following commands and any output from the commands.1) ll to show the original 3 files2) run the tar command to stuff three files3) ll to show the 'tar archive'4) mkdir newdir to create a new directory to unstuff the 'tar archive'
Ubuntu, Linux, MacOS use one of these systems. 1a. Create a C program that forks a...
Ubuntu, Linux, MacOS use one of these systems. 1a. Create a C program that forks a child process that executes the command ‘ls’. 1b. Extend the program you created in Problem 1a such that it takes an argument. For example, the created child process should be able to execute the command ‘ls’ with any arbitrary single argument such as ‘ls -l’, and ‘ls -a’.
Part 2 – Scripting Goals:  Write a bash script  Use linux shell commands within...
Part 2 – Scripting Goals:  Write a bash script  Use linux shell commands within your script  Provide user feedback  Use loops  Use conditionals Remember to use chmod +x to make your file executable! Each script is 5 points in the Specifications portion of the rubric. Don’t forget to maintain good standards and comments. Script 1 – Echo-back some information Write a script name hello.sh that will take the user’s first name as a command line...
Look up and use each of these Linux commands. (Each command will have two parts) Summarize...
Look up and use each of these Linux commands. (Each command will have two parts) Summarize their function then use the command Use the Command and document the output (<parameters of your choice> Command Function info cat Demonstrate 'cat' in use   man cp Demonstrate 'cp' in use   man touch Demonstrate 'touch' in use   man mv Demonstrate 'mv' in use   man rm Demonstrate 'rm' in use   info wc Demonstrate 'wc' in use   man find Demonstrate 'find' in use   man chmod Demonstrate...
Question 3: What do the following vim commands do in command mode? ZZ :w! i dd...
Question 3: What do the following vim commands do in command mode? ZZ :w! i dd x yy p Question 4: Review the following code. If you were to print out all the dereferenced values of the three pointer variables and the array, what is the output? (note: if possible explain how the output changed.) int array[] = { 30, 40, 50, 60, 70, 80 }; int *ptrA = array; int *ptrB = ptrA + 4; int *ptrC = ptrB--;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT