하이텔 리눅스동호회의 이길현님이 만든 스크립트입니다..
 
#!/bin/csh
########################################################
#
# 
<< Filename Case Conversion Script 
>>
#
########################################################
#
# 
설명 : 현재 디렉토리에 있는 화일의 대*소문자 이름을
# 일괄적으로 바꾸어줍니다. 홈페이지 문서를 계
# 정상에 FTP를 이용하여 
올리게 되면 간혹가다
# 화일이름들이 대문자로 바뀌는 경우가 있는데
# 이 스크립트를 이용하게 되면 한번에 쉽게 소
# 문자로 
바꿀수가 있습니다. 유용하게 활용을..
# Usage : tocase -[l|u] input_file
# Date : 
1998/12/23
# Author : Kil-Hyun Lee
# E-Mail : <loadhyu2 [at] hitel [dot] net>
# Homepage : http://kitel.co.kr/~loadhyu2/
#
########################################################
#
# 
argument count check
# if ( $# != 2 ) goto error
#
# parse 
option
#
######################################################## 
# renamed file number
set count = 0 
echo " "
echo "*********** tocase script starting... ***********"
echo 
" " 
switch ($1)
case "-l" :
foreach file ( * )
# 입력파일이름을 소문자로 
저장합니다.
set file2 = `echo $file | tr A-Z a-z` 
# 파일이 같은지를 검사합니다.
if ( $file != $file2) then
mv $file $file2
echo 
$file is renamed $file2
@ count++ # 변환된 파일개수를 
카운트합니다.
endif
end
breaksw 
case "-u" :
foreach file ( * )
# 입력파일이름을 대문자로 저장합니다.
set file2 = 
`echo $file | tr a-z A-Z` 
# 파일이 같은지를 검사합니다.
if ( $file != $file2 ) then
mv $file $file2
echo 
$file is renamed $file2
@ count++
endif
end
breaksw 
case "--help" :
case "-h" :
case "-?" :
goto error 
case "--version" :
case "-v" :
echo "tocase version is 
0.0.1"
breaksw 
default :
goto error
endsw 
#######################################################
#
# 
Successfully Exit 
echo " "
echo "-> Total $count files is renamed successfully!"
echo 
" " 
#if ($1 == "-l") then
# echo "Total $count files is lowercased 
successfully!"
#else if ($1 == "-u") then
# echo "Total $count files is 
uppercased successfully!"
#endif 
exit 0
#######################################################
# Display error 
message and quit
# 
error:
cat << 
END_OF_ERROR
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Dear $USER, 
the usage of tocase is as follows: | "Wonder Boy" --\->
[Usage] : tocase 
-[l|u] input_file |__________________________ 
tocase -l input_file means "input_file name is from uppercase to 
lowercase"
tocase -u input_file means "input_file name is from lowercase to 
uppercase"
---------------------------------------------------------------------------
END_OF_ERROR 
#######################################################
# Unsuccessful exit!
exit 1
'ETC' 카테고리의 다른 글
| 창움직이기(?) (0) | 2001.08.08 | 
|---|---|
| bash의 명령행 완성 (0) | 2001.08.08 | 
| 가상콘솔수 조정하기 (0) | 2001.08.08 | 
| alias 사용하기 (0) | 2001.08.08 | 
| 리눅스 카운터에 등록해봅시다~ (0) | 2001.08.08 |