# For: 		Ablah Library Wichita State University
# Date:		July 2nd 2001
# Server: 	libweb.ablah.twsu.edu
# Purpose: 	To automate the process of banning a user from telneting into this machine.
#		By putting a file in every user's directory.
#		Script goes into every directory and put a file called .profile
#		This file have just one statement "exit"

#!/bin/sh


ls -l | grep dr | tr -s " " | cut -f 9 -d " " > july2_2001_dir.txt
wc -l july2_2001_dir.txt | tr -s " " | cut -f 2 -d " " > total_users.txt
let tnu=`cat total_users.txt`

	let var1=0
	while [ $var1 -le $tnu ]
	do
	let tail_count=$tnu-$var1
		if test $tail_count -eq 0 ; then 
		exit 0
		fi

	echo "tail_count=$tail_count"
	dir_name=`tail -n $tail_count july2_2001_dir.txt | head -n 1` 
	cd $dir_name
	pwd
	echo "exit" > .profile
	cd ..
	let var1=var1+1
	done

    Source: geocities.com/shezy22/code

               ( geocities.com/shezy22)