#!/bin/csh -f # Script to set up student accounts as a follow-up to the # instructor's use of /opt/proto/instructor-setup ############################################################### set classproj = 2004 set classhome = '~caviness/Class/CISC181013' set cshrc = $HOME/.cshrc # Use context split to split at the comment line set xx = /tmp/$USER \csplit -s -f $xx $cshrc '/^### Project /' >& /dev/null # If the comment line is found, then ${xx}00 has everything up to the # comment and ${xx}?? gets everything else if -f ${xx}00 then \mv ${xx}00 $cshrc if (`wc -l ${xx}01 | awk '{print $1}'` > 3) then echo "Moving part of your .cshrc file into Old.cshrc-tail." echo "The moved commands are no longer part of your .cshrc file." \cat ${xx}?? >! Old.cshrc-tail else \rm ${xx}?? endif endif # Check to see if the groupname command is installed # Copy three lines to the end of the new .cshrc file using groupname \cat <> $cshrc ### Project specific .cshrc - Set current project and source its file source /opt/proto/cshrc-project EOF # Make symbolic link to the .classrc file as the students' .cshrc-proj \rm -f $cshrc-$classproj echo source '~caviness/Class/CISC181013/.classrc' > $cshrc-$classproj