In: Computer Science
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.
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:
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.
#!/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 :)