
#!/bin/csh -f
set no=1460
while ("$no">0)
if [$no>900]; then
set m=3
else if ["$no">450 && "$no"<901]; then
set m=2
else
set m=1
fi
mv *$no.bin test/abc-$m-$no.bin
set no =$no-1
end
csh 스크립트를 사용하여 1460개 파일의 이름을 바꾸려고 하는데 쉘에서 "Syntax error: Unexpected end of file" 구문 오류가 발생합니다 tcsh
.
두 가지 방법을 모두 시도했는데 이런 상황이 발생 fi
했습니다 . 나도 같은 실수를 저질렀다.end
if
답변1
빠른 Google 검색을 통해 귀하의 IF
진술이 구문적으로 올바르지 않을 수 있음을 보여줍니다. 다른 셸의 구문을 혼합하고 있을 수 있습니다.
if ( $no > 900 ) then
set m=3
else if ( $no > 450 && $no < 901)
set m=2
else
set m=1
endif
http://beefchunk.com/documentation/tips/unix_tips_and_tricks/node40.html