#!/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. #------------------------------------------------------------------ # -IAN! idallen@idallen.ca # Use standard search path, friendly umask, ASCII collating and sorting. # Set the language and character set to be ASCII/C standard. # PATH=/bin:/usr/bin ; export PATH LC_COLLATE=C ; export LC_COLLATE LANG=C ; export LANG umask 022 # 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:' \ | head -2 \ | tail -1 ) # Translate spans of multiple blanks to one single blank. # echo "The temperature in Ottawa is $temp" | tr -s ' '