To ensure your docker image is up-to-date with content for this and later labs, you should run docker pull again. The
docker run command only pulls a new image if you don't have one already on your machine. To update your lab image, run
the following command outside of a docker container:
docker pull nebuzaradan/cits4407:v0
Your friend has sent you more game data in updated_cool_online_game.csv. Which players have improved their scores?
The following questions make use of globbing
List all files in /bin that start with the letter g
List all files in /bin that end with the letter t
List all files in /bin that start with the letter g and end with the letter t, where the second letter is not e
Write a script texter.sh that accepts any number of command line arguments.
It should create a text file using the first argument as the file name and the second argument as the file content.
Repeat for all remaining arguments. If there is an odd number of arguments, leave the last file blank.
> ./texter.sh f1 "this is file 1 content" f2 "deadbeef"
> cat f1
this is file 1 content
> cat f2
Write a script sizes.sh which prints stats about each file in the current directory.
For each file it should print the filename and file size
After printing data for all files, print the size and name of the largest file, then print the sum of all the file sizes.
Your script should ignore directories.
Hint: You can obtain the size of a file as a number by using wc -c with cut
Largest is 448821 in Frankenstein.txt
Sum is 619364
Note your final size may vary if you've changed the size of any files (such as the sizes.sh script)
Modify sizes.sh to accept the command line options as specified below. Use shift and case to achieve this:
-d DIRECTORY Count files in DIRECTORY instead of .
-h Display this help message and exit
When would you prefer a while loop over a for loop? When would you prefer a for loop? What is a danger of using a while loop?
Modify sizes.sh to accept the following command line option:
-r Instead of ignoring directories, recursively run stats.sh in each directory found.
Department of Computer Science & Software Engineering
The University of Western Australia
Last modified: 8 February 2022
Modified By: Daniel Smith