Question

In: Computer Science

CSCE 3600: Systems Programming Recitation Assignment 4 – Bash script Due: 06:00 PM on Monday October...

CSCE 3600: Systems Programming

Recitation Assignment 4 – Bash script

Due: 06:00 PM on Monday October 12 2020

DESCRIPTION: You need to write a bash script to compile and execute a C program. Please feel free to ask for assistance from your TA or fellow classmates, but make sure that you turn in your own work. Please note that you are writing bash scripts, not C programs, for this exercise.

  1. Write a bash script that accepts a C file name as a command-line argument. If the user does not enter a command-line argument when invoking this shell script, you will simply output: "No file provided to run!"
  2. If the file compiles successfully, the script should run the executable file, otherwise the script should output “Compilation error/s, please, check output for issues”.
  3. Before compilation, your script should check if an executable file already created and if it is and date/time stamp of it is greater than date/time stamp of the input C file, the script should not recompile the C file and just run the executable.
  4. You should test your script on your Recitation 1 assignment C program.

SAMPLE OUTPUT:

$ ./rec04.sh HelloWorld.c

… Output of a compiler

Hello World!

$ ./rec04.sh HelloWorld.c

Hello World!

$ ./rec04.sh

No file provided to run!

REQUIREMENTS:

  • Your bash scripts will be graded based largely on whether they work correctly on the CSE machines
  • Although this assignment is to be submitted individually (i.e., each student will submit his/her own source code). Please remember that you are ultimately responsible for learning and comprehending this material as the recitation assignments are given in preparation for the minor assignments, which must be completed individually.

SUBMISSION: • You will electronically submit your “FirstName_LastName_05.sh” program file to the Recitation 4 Assignment in Canvas by the due date and time.

Solutions

Expert Solution

#!/bin/bash

if [ $# -ne 1 ]
then
   echo "No file provided to run!"
elif [ ! -f $1 ]
then
   echo "There is no $1 file found , check name"
else
   gcc $1
   ./a.out
fi

if you have any doubt then please ask me without any hesitation in the comment section below, if you like my answer then please thumbs up for the answer, before giving thumbs down please discuss the question it may possible that we may understand the question in a different way and I can edit and change the answers if you argue, thanks :)


Related Solutions

CSCE 3600: Systems Programming Recitation Assignment 3 – Sed and Gawk Due: 06:00 PM on Monday...
CSCE 3600: Systems Programming Recitation Assignment 3 – Sed and Gawk Due: 06:00 PM on Monday October 12 2020 DESCRIPTION: In this recitation assignment, you will just practice to run sed and gawk commands and record your work session into a file. In other words, just type and run commands specified in bold Consolas (except $ sign :) below on your terminal. Let’s start. First, open a terminal (bash) session. Issue the first command $ script FirsName_LastName_04.txt where FirsName_LastName_04.txt is...
STAT 2023 Assignment 8 Fall 2019 due by 10pm on Monday, October 21 Estimation of the...
STAT 2023 Assignment 8 Fall 2019 due by 10pm on Monday, October 21 Estimation of the Population Mean, Lesson 13 Whitmore Farms sells theAmeraucana hens who lay light blue eggs. A random sample of 64 of these hens produced a mean standing height of 14.4 inches. The standard deviation of standing height of Ameraucana hens is known to be .8 inch. Use this information to answer the rest of the questions on this assignment. 1. What is the point estimate...
A boat leaves a dock at 2:00 PM and travels due south at a speed of...
A boat leaves a dock at 2:00 PM and travels due south at a speed of 15 km/hr. Another boat has been heading due east at 20 km/hr and reaches the same dock at 3:00 PM. How many minutes after 2:00 PM were the two boats closest together?
A random sample of 100 customers was chosen in a market between 3:00 and 4:00 PM...
A random sample of 100 customers was chosen in a market between 3:00 and 4:00 PM on a Thursday afternoon. The frequency distribution below shows the distribution for checkout time, in minutes. Checkout Time 1.0-1.9 2.0-2.9 3.0-3.9 4.0-5.9 6.0-6.9 Frequency 8 22 Missing Missing Missing Cumulative Relative Frequency Missing Missing 0.84 0.98 1.00 (a) Complete the frequency table with frequency and cumulative relative frequency. Express the cumulative relative frequency to two decimal places (b) What percentage of checkout times was...
A random sample of 100 customers was chosen in a market between 3:00 and 4:00 PM...
A random sample of 100 customers was chosen in a market between 3:00 and 4:00 PM on a Thursday afternoon. The frequency distribution below shows the distribution for checkout time, in minutes. Checkout Time 1.0-1.9 2.0-2.9 3.0-3.9 4.0-5.9 6.0-6.9 Frequency 8 22 Missing Missing Missing Cumulative Relative Frequency Missing Missing 0.84 0.98 1.00 (a) Complete the frequency table with frequency and cumulative relative frequency. Express the cumulative relative frequency to two decimal places (b) What percentage of checkout times was...
Assignment Write a network diagnostics bash script that does the following: Finds the IPv4 address of...
Assignment Write a network diagnostics bash script that does the following: Finds the IPv4 address of the default gateway on your machine (one way to get this is the 'default' entry, also shown as 0.0.0.0, in the output of 'ip route') and runs a ping (with a count of 5 pings) to it. Runs another count of 5 pings to the site example.com. Outputs a 1-line summary of interfaces on your machine, not including the loopback address (lo). Outputs a...
CSC 101 Assignment 3 Barista Assistant Due Date: Friday, October 30 at 11:59 PM Learning Objectives:...
CSC 101 Assignment 3 Barista Assistant Due Date: Friday, October 30 at 11:59 PM Learning Objectives: Practice combining your knowledge of conditionals, loops, functions, strings, and lists. What to Submit: Write your program in a Python script named barista.py. Submit this file to the Assignment 3 page on Canvas. Description The purpose of this assignment is to write a Python program for a cafe to help baristas create coffee for a customer. Your program will take the customer's order and...
Due: May 10, 2019 at 10:00 PM Briefly summarize the competitive process that transpires from the...
Due: May 10, 2019 at 10:00 PM Briefly summarize the competitive process that transpires from the short-run to the long-run in perfectly competitive market structures and contrast it with what happens during the same time horizons in the monopoly industries. What major differences between a monopoly and a perfectly competitive firm can be clearly seen when comparing the graphs illustrating their short-run average and marginal production cost curves, as well as demand and marginal revenue curves? In what industry structure...
Econ 335: Assignment 4 Due: April 20th by 11:59 PM 1.     To protect American jobs, the...
Econ 335: Assignment 4 Due: April 20th by 11:59 PM 1.     To protect American jobs, the US government may decide to cut US imports of bulldozers by 60%. It could do so by either: -Imposing a tariff high enough to cut bulldozer imports by 60% -Persuading Komatsu and other foreign bulldozer makers to set up a voluntary export restraint arrangement to cut their exports of bulldozers to the US by 60%. a. Which of these two policies would be less...
A pizza pan is removed at 4:00 PM from an oven whose temperature is fixed at...
A pizza pan is removed at 4:00 PM from an oven whose temperature is fixed at 450 degrees F into a room that is a constant 74 degrees F. After 5​ minutes, the pizza pan is at 300 degrees F. a. At what time is the temperature of the pan 125 Degrees F b. Determine the time that needs to elapse before the pan is 200 Degrees F c. What do you notice about the temperature as time passes?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT