Command fails the exit status not then perform command
Short for "make directory". As you should know from the textbook, the mkdir command will create a sub-directory. However, this command can take in command options!
mkdir -p <PATH> If the directory you are trying to create already exists, do not output an error.
grep -q <PATTERN> <FILE> q stands for quiet and says to not write anything to stdout
grep -F <PATTERN> <FILE> Interpret the provided pattern(s) as a fixed string, not as regular expres- sions. Note that this is an upper-case ’F’!
2.2.1 IFS
IFS is a special bash environment variable that stands for Internal Field Separator. This command is commonly used by the read command, parameter expansion, or command substitution. By default IFS is set to be <space><tab><newline>, which means that if something is being read, any occurrence of a space, tab, or newline will be interpreted as the end of a word. Example, if you have a text file that contains the following:
|
---|
|
---|
|
---|
|
---|
Instead, if you wanted to output on stdout the exact contents of the file, line by line, the value of IFS would have to be set (before the for loop) to equal the newline character, and the newline character alone.
|
---|
The above specifies that if the provided variable contents is a string, then the entire string should be converted to all upper-case characters.
Page 3
2.2.4 The double pipe (||)
Question 1 (20 points):
Have you ever had someone ask you for music recommendations based on
genre? If so, have you ever gone to your “Liked Songs" in say, Spotify,
and tried to filter your songs based on genre but couldn’t? I have. The
only solution I’ve been able to think of has been to store song data in
a pretty convoluted and kinda wacky way... So here we are.
The Problem
Album Type Describes whether the song was released as an: album, single, or compilation.
Album Name Name of the album that the song appears on.
Release Year The year in which this version of the song was released.
Preview URL A link to listen to a preview of the song. (This is a real link and will provide you a 30 second clip of the song.)
Page 5
A small example of the directory structure:
Complete the following tasks:
(a) OPTIONAL: If you wish, create progress output. Print a message after every 50 lines read that X entries (where X is a multiple of 50) have been processed. However! If you do decide to do this make sure that it doesn’t negatively impact the readability of your script (or remove it before submitting). If the readability is negatively impacted and your marker has issues reading it, then you may potentially lose marks.
(b) Extract and format all data from the line (song data) into variables. Note the following special cases:
v. If there is a featured artist for the track then the song name must be formatted as: <SONG_NAME>_(ft._<FEATURED_ARTIST(S)>)
Page 6
Sample Output
This script should not output anything, other than an optional progress update. However, a small snippet of what should be contained in your directory t:
|
---|
Morning: https://p.scdn.co/mp3 -preview/ a51b283faefdd10a50253a4b33a2d8750a844c8b |
|
---|
Page 7
5 What to Hand In
Hand in a .zip file archive which contains the following files:
oEBBBggg•
Page 8