#!/bin/sh -u # $0 (no arguments) # Purpose: Read two filenames. Translate the first file to UPPER CASE # and store into the second file. # # WARNING: Many of the comments in this file are "Instructor-Type" # comments and are *not* appropriate for real scripts. Do not put # "Instructor-Type" comments into the scripts that you submit for marking. # I put them in my example files because I am teaching you how to # write scripts; do not submit my teaching comments back to me again. # -IAN! idallen@ncf.ca # Set the search path for the shell to be the standard places. # Set the umask to be non-restrictive and friendly to others. # export PATH=/bin:/usr/bin umask 022 # Prompt (always on standard error) for two file names. # Read two names into shell variables $infile and $outfile. # - NOTE: no dollar signs are used in the "read" statement! # echo 1>&2 "Please enter an input file and output file name:" read infile outfile # Translate the input file as UPPER-CASE into the output file. # The current umask determines the new permissions of the output file # if it doesn't already exist. # Always quote the use of variables to prevent the shell from expanding # glob/wildcard characters inside them. # Quote the two arguments to "tr" as well, just to be safe. # tr 'a-z' 'A-Z' <"$infile" >"$outfile"