CSCI 157: UNIX Power Utilities and Shell Programming
Laboratory Assignment 5
1. TURN-IN a hard copy of the following:
- On all homework please include
- Your Name
- Course Number
- Date
- ecst login name
- No questions from the book this lab
- Write one of the scripts described below
- Use ANY language and any tools you want
- Your friend does not count as a "tool", you can not simply copy their script
- TURN-IN printout of script
- Have a soft copy on your ecst account so you can demo it
There are 5 options for this script
- Write a script to get the current temperature in Chico and figure out someway to get the temperature into your bash prompt
- Options include getting additional information in your prompt such as "rainy", "cloudy", the humidity, etc.
- Ideally you could do something like change a zip code variable and then start getting temp info for another city
- Write a script to get the current bid price for some ebay item and figure out someway to get it into your bash prompt
- Options include having the closing date/time for the
auction in your prompt, whether or not you are the high bidder, item
title, etc.
- It should be easy to update by changing a variable in your script so that you can easily start monitoring a different item
- Write a script to get the current price for some stock and store it in your prompt
- Options include also showing the most recent change, +1.20, keeping track of the values for the past week, other?
- It would be nice if you could change a setting and start getting info for another stock without any extra work
- Write the super hacker extreme script
- Write it so that it can do any or all of the above by simply changing a variable or two.
- If you do this we will call you "zero cool" for the rest of the semester (from "hackers" movie)
- Come up with your own
- Get permission to do the same type of thing but with some other type of information off the web
- Please email me or talk with me before hand if you want to do something other than one of these first three options
- I am game for most anything that fits this same model
Main concepts behind this script
- Script should get information off of the web by downloading a webpage somehow (using lynx, wget, perl or similar)
- Script should parse the webpage somehow to extract relavent information
- Script should put info into evironmental variables somehow
- Shell should take info out of environmental variables and put it in the prompt
- Script should include some kind of extra option like those described above
- Another possiblity for extra options would be error
handling, what if it can't connect to server? It would be nice to see
an error message in the prompt rather than still think ATT is at 50 if
it has dropped to 10
- Everyone will have a different script because nobody should choose the same extra options.
- Script would be ran by cron on most systems, for our
purposes we can just put it into the background and have it sleep so
that it only runs every minute or so.
- Ideally it would be easy to pass on your script.
- Include a some instructions about how to use it or install it if necessary
- Use utilities/language features that are common (not required) so it will work on most systems
- We will have either real or imaginary prizes for the best ones.
Examples:
Simple weather prompt:
76 in Chico, partly cloudy : /user/s/toddj $
A multiple line ebay prompt utilizing color:
Partially Working 23" TV Set - $500
You are the High Bidder - Bid ends in 15 minutes
toddj@tiglon $
A stock quote prompt utilizing color:
ATT=$23 -1 toddj@tiglon: /etc >
A stock quote prompt utilizing color that has failed to recieve new updates:
Stock Quote Update Failing - ATT last at $23 toddj@tiglon: /etc >