Okay, just follow along, questions will be denoted with a Q. Fill in answers in a text file called lab2.
Q 1: What is the output?
Q 2: What would the find command be to find all files that end in .bash?
Q 3: What is the output?
Q 4: What were the results?
Q 5: How could you use grep, wc (with the -l option), and a pipe to find how many lines contain the string "the"?
Q 6: What is different?
Q 7: Explain the output
Q 8: What did you see this time?
Q 9: Explain the different return values (the man pages might help)
breadIsDangerous.txt 73 431Do not use find
spellExample 5 21
Q 10: Upload count.bash
$ reextend .log .txt
Would cause install.log to be renamed to install.txt, and
$ reextend A B
Would cause TADAA to be renamed to TADAB . It would also cause file.A to be renamed file.B .
The script should print out error messages as is appropriate if
there is any problem with the command line arguments. Test the script
with a range of different parameters, including incorrect parameters
or missing parameters.
hint: See Parameter Expansion in the bash man or info page.
Q 11: Call this script reextend, and upload it w/your lab.
Led Zeppelin - Over the Hills and Far Away.mp3
, all in the same directory. What you really wanted was to have the songs in directories by artist, and just the song name for the filename:
Led Zeppelin/Over the Hills and Far Away.mp3
So, write a script that looks in the current directory only for mp3 files, breaks the filename out into artist and song title, creates the appropriate directory (if it doesn't already exist), removes the artist and the first ' - ' from the filename, and moves it into the directory.
Q 12: Call this script organiseMusic, and upload it w/your lab.