#!/bin/sh -u # A weather script to show the current temperature in Ottawa #------------------------------------------------------------------ # Syntax: $0 (no command line arguments used) #------------------------------------------------------------------ # Purpose: # Display the current weather for Ottawa. #------------------------------------------------------------------ # Student Name: Ben Dover # Algonquin EMail Address: abcd0001 # Student Number: 074-210-779 # Course Number: NET2003 # Lab Section Number: 014 # Professor Name: Ian Allen # Assignment Name/Number/Date: This is a sample exercise label # Comment: This is a sample. #------------------------------------------------------------------ # Use standard search path, friendly umask, ASCII collating and sorting. # PATH=/bin:/usr/bin ; export PATH umask 022 LC_COLLATE=C ; export LC_COLLATE # Note the need to quote the URL because of the shell metacharacter. # You may use a backslash to hide newlines from the shell, so that # the long line can be written more readably as many lines in the script. # For readability, lines should be limited to 80 characters long or less. # temp=$( lynx -dump 'http://text.weatheroffice.ec.gc.ca/forecast/city_e.html?on-118' \ | grep -A 1 -e 'Temperature:' \ | tail -1 ) # Translate spans of multiple blanks to one single blank. # echo "The temperature in Ottawa is $temp" | tr -s ' '