Skip to content

Latest commit

 

History

History
5 lines (3 loc) · 545 Bytes

File metadata and controls

5 lines (3 loc) · 545 Bytes

Searching For a File

Try writing a script that accepts a command-line argument corresponding to a filename. The script should then look for that file in the current directory. If the file is found, the script should print out the last line in the file. If it's not found, the script should create the file and add some text inside (e.g., "This file was just created.").

Note that there are several different ways to accomplish these goals (particularly of finding a file). See if you can think of more than one way. Which is most efficient?