home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / sco / scripts / lowercase < prev    next >
Encoding:
Korn shell script  |  1997-08-26  |  635 b   |  27 lines

  1. #!/bin/ksh
  2. # @(#) lowercase.ksh 1.0 92/10/08
  3. # 92/10/08 john h. dubois iii (john@armory.com)
  4.  
  5. if [ $# -eq 0 -o "$1" = -h ]; then
  6.     echo \
  7. "$0: change filenames to lower case.
  8. Usage: $0 file ...
  9. Each file is moved to a name with the same directory component, if any,
  10. and with a filename component that is the same as the original but with
  11. any upper case letters changed to lower case."
  12.     exit
  13. fi
  14.  
  15. typeset -l filename
  16.  
  17. for file; do
  18.     filename=${file##*/}
  19.     newname="${file%%*([!/])}$filename"
  20.     if [ "$newname" != "$file" ]; then
  21.     mv "$file" "$newname"
  22.     echo "$file -> $newname"
  23.     else
  24.     echo "$file not changed."
  25.     fi
  26. done
  27.