




	Lab 6 Solutions (page 1)

	1.	set `date "+%Y %B %A %m %U %j %d %X %p %Z"`
	  	echo The year is $1.
	  	echo The month is $2.
	  	echo The day is $3.
	  	echo The month of the year is $4.
	  	echo The week of the year is $5.
	  	echo The day of the year is $6.
	  	echo The day of the month is $7.
	  	echo The time is $8 $9.
	  	echo The time zone is ${10}.
	
	2.	args=$*     # Save args for later in case we need 'em
          	while [ $# -gt 0 ]
          	do
             		echo Length of $1 is ${#1}
             		shift
          	done
	
        3.	PURGEDIR=${PURGEDIR:=.purgefiles}
          	echo $PURGEDIR

	4.	# purge script.  Copy argument files to .purgefiles
		if [ $# = 0 ] ; then
   		   echo "Usage: $0 [?] file ..."
   		   exit 1
		fi

		if [ $1 = "?" ]
		then
   		   ll $HOME/.purgefiles
		else
   		   if [ ! -d $HOME/.purgefiles ] ; then
      		      mkdir $HOME/.purgefiles
   		   fi
   		   for f in $*
   		   do
      		      if [ -r $f ] ; then
	 	         mv $f $HOME/.purgefiles
      		      else
	 	         echo "$f not a readable file"
      		      fi
   		   done
		fi

		#--- clean script
		ll $HOME/.purgefiles
		echo
		echo "Remove all files from $HOME/.purgefiles? \c"
		read a
		if [ "$a" = y ] ; then
   		   rm $HOME/.purgefiles/*
		fi
