Weather GIF animation

Your assignment is to write a bash script named "weather.bash" that downloads three fixed GIF files, and pastes these together into a GIF animation.

It should run in this manner:

[test@localhost bin]$ ./weather.bash out.gif     # This invocation was successful, creating the below out.gif file
[test@localhost bin]$ ./weather.bash out.gif bogus.gif   # This invocation incorrectly named two output files
Please give only one argument, the output file.

USAGE: ./weather.bash OUTPUTFILE
Your OUTPUTFILE will be a GIF file, so please use .gif as the terminal portion of the filename
[test@localhost bin]$ ./weather.bash out.giff    # This invocation incorrectly specified ".giff", not ".gif"
USAGE: ./weather.bash OUTPUTFILE
Your OUTPUTFILE will be a GIF file, so please use .gif as the terminal portion of the filename
[test@localhost bin]$ ./weather.bash             # This invocation incorrectly failed to specify an output file
Please give only one argument, the output file.

USAGE: ./weather.bash OUTPUTFILE
Your OUTPUTFILE will be a GIF file, so please use .gif as the terminal portion of the filename

      

Here's the result file (from the first, successful invocation at out.gif):

As you can see, the script checked for three different errors: no output file specified, two or more output files specified, and for an output file that does not end in ".gif". Your script should make all three tests, and give the above error messages when any of these problems is detected. It's best practice to create a "usage" function so that you can give a consistent usage message for failures.

The source URLs for the GIF files to be pasted together are:

You may use curl, wget, or something more challenging to fetch the URLs (nc, for instance, would be a reasonably challenging tool; another, much more challenging one, would be telnet.)

Please include code to check to make sure that the three components are accessible (while these three files have been available for many years, many of their companion products have been discontinued, and, as the NWS continues to "modernize" its services, it will likely stop producing even these highly useful graphics.)

However, whichever method you use to fetch the GIF components, you may not make any temporary files. Instead, use the process substitution technique that we discussed on Wednesday to avoid creating any temporary files. Using temporary files is always a poor solution, and should be avoided in all of your programming tasks.

The server has a program "gifsicle" which will let you paste your three GIF files into a single GIF animation. When you run gifsicle, please make sure that you create an endless loop, and that your delay between frames is between 1 and 3 seconds (I used 1 second). Please note that gifsicle will complain about your input files, and will correctly suggest an additional option, which you should include.

Please leave the "weather.bash" script in your ~/bin/ subdirectory on the 45.56.74.139 server. (You will have to use "mkdir" to create this directory.)

The assignment is due by 2:00pm on Wednesday, February 5.