Listing 7: Rename script
#!/bin/sh
##################################################################
# Script: /oem/sun/drm/ds_scripts/rename.local.exe
# Purpose: This script finds all of the local.files in the /home
# directory and creates script rename.local which
# renames them to the correct names.
# Updates: 4/1/94 Created. CIC
##################################################################
#
SCRIPTHOME="/oem/sun/drm/ds_scripts"
export SCRIPTHOME
#
# Find all /home/userid/local.xxxxx files.
#
find /home/* \( -name local.cshrc -o -name local.login -o -name local.profile \) \-print >
$SCRIPTHOME/rename.local1
#
# Change file names from /home/userid/local.xxxxx to
# /home/userid/. files and place in temporary file.
#
sed '1,$s/local././g' $SCRIPTHOME/rename.local.temp1 > \
$SCRIPTHOME/rename.local.temp3
#
# Precede all lines with mv command and place in temporary file.
#
sed '1,$s/.*/mv &/' $SCRIPTHOME/rename.local.temp1 > \
$SCRIPTHOME/rename.local.temp2
#
# Paste the two temporary files together to create the following
# script:
#
# mv /home/userid/local.xxxxx /home/userid/.xxxxx
#
paste -d"\t" $SCRIPTHOME/rename.local.temp2 \
$SCRIPTHOME/rename.local.temp3 > $SCRIPTHOME/rename.local.temp
#
# Chmod for rename.local to 700.
# and execute it.
#
chmod 700 $SCRIPTHOME/rename.local.temp
. $SCRIPTHOME/rename.local.temp
#
# Add /etc/skel/generic.ksh.profile and /etc/skel/generic.csh.profile
# to the end of batch login .profile and .login
#
. $SCRIPTHOME/batchlogin.profile.update
#
# Delete temporary files.
#
rm $SCRIPTHOME/rename.local.temp*
#
# End of File
|