In order to successfully complete this assignment you need to participate both individually and in groups during class. If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class on Wednesday January 27. If you are attending asynchronously, turn in your assignment using D2L no later than 11:59pm on Wednesday January 27.
✅ QUESTION: What are the key components of a programming language? What are the minimally useful set of commands you need to do something interesting in a programming?
EXAMPLE: Run the following command in the BCCD Directory.
echo $PATH | sed -e "s/:/\n/g"
EXAMPLE: Run the following command in one of the BCCD Directories with a Makefile
.
cat Makefile | grep cd | grep MAKE | cut -d "d" -f2- | cut -d ";" -f 1 | sort | uniq
Challenge 1: Write a BASH script to loop though a list of usernames (ex ./BASH/usernames.txt
) and print out any jobs each person may have running using squeue -l -u $USERNAME
.
Challenge 2: Write a bash script that finds all of the files in the current directory of the form slurm-#######.out and prints out only the jobid (i.e #######). For an extra challenge, use the squeue
command to check and see if the job is still running and print "RUNNING" or "COMPLETE" next to the job number.
Challenge 3: Write a submission script that takes a command as an input and runs the command 10 times and prints the time to the screen. For an extra challenge also print the average time.
Challenge 4: Write a bash script that renames all of the files in a directory with the out
extension to all uppercase.
Challenge 5: Write a bash script to start a program and make sure it only runs for 1 minute. If the program takes longer than a minute to run it should be "killed" an an error message printed to the screen. For simplicity, use the sleep 10
command as the "test" program. For an extra challenge allow the long running command to be passed into the script as an input variable.
If you attend class in-person then have one of the instructors check your notebook and sign you out before leaving class. If you are attending asynchronously, turn in your assignment using D2L.
Written by Dr. Dirk Colbry, Michigan State University
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.