#
#####Message Texts######
set mesg1 = "Please enter the name of the user to be changed:"
set mesg2a = "User id "
set mesg2b = " not found, please check and try again."
set mesg3 = "Please enter new numeric id number, (default is "
set mesg4a = "User id number "
set mesg4b = " is already taken, please select another."
set mesg5 = "Please enter new numeric group id number (default is 10): "
set mesg6 = "The updating of the user's files is now occuring in the background."
set mesg7b = ")."
########################
						# get specific login name 
echo -n $mesg1' '
scanname:
set name = ($<)
if ($#name == 0) then
	goto scanname
endif
						# tell awk what name to match
						# make sure this user exists
awk '{FS=":"} {print $1}' /etc/passwd > foo
fgrep -s $name foo
if ($status == 1) then
	echo -n $mesg2a $name $mesg2b' '
	goto scanname
endif

awk '{FS=":"} {print $3}' /etc/passwd > foo
set i = 2
loop:
	fgrep -s $i foo
	if ($status != 1) then
		set i = `expr $i + 1`
		goto loop
	endif	# not reached
						# get unique login number 
echo -n $mesg3$i$mesg7b
scanuid:
set uid = ($<)
if ($#uid == 0) then
	set uid = $i
endif
						# check uid for uniqueness
fgrep -s $uid foo
if ($status != 1) then
	echo -n $mesg4a $uid $mesg4b' '
	goto scanuid
endif
						# get new group number 
echo -n $mesg5' '
set gid = ($<)
if ($#gid == 0) then
	set gid = '10'
endif
					# update dirs and files owned by user	
echo $mesg6

/bin/rm foo
