#!/bin/sh -u # # $0 [ arguments...] # # A script that classifies arguments given on the command line # to tell if they are empty (the empty string) or not. # # A list is built by the script and output at the end. # The list has "comma blank" separated items. # # -IAN! idallen@ncf.ca June 2001 export PATH=/bin:/usr/bin umask 022 # Start with an empty list and append the non-empty arguments. # # The separator between arguments is empty for the first argument. # After putting in the first argument, the separator becomes ", " for # all subsequent arguments. The result is a nice-looking list. # arglist="" separator="" for arg do if [ "$arg" = "" ]; then echo "Found an empty argument." else arglist="$arglist$separator$arg" separator=", " fi done echo "The list of non-empty arguments is: $arglist" exit 0