#!/bin/sh -u # $0 [ strings...] # A script that looks for strings in the password 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. # Read the week7.txt notes for more details on good comment style. # # -IAN! idallen@ncf.ca October 2001 export PATH=/bin:/usr/bin umask 022 file=/etc/passwd # Loop for each command line argument. # This "for" loop defaults to using "$@". # for string do # The command line following "if" and "while" can be any # Unix command. The return status is checked. # I redirect output to /dev/null to throw it away. # if grep -e "$string" "$file" >/dev/null ; then echo "String '$string' is in $file" else echo "Cannot find '$string' in $file" fi done