![구문 오류: 예기치 않은 파일 끝](https://linux55.com/image/37106/%EA%B5%AC%EB%AC%B8%20%EC%98%A4%EB%A5%98%3A%20%EC%98%88%EA%B8%B0%EC%B9%98%20%EC%95%8A%EC%9D%80%20%ED%8C%8C%EC%9D%BC%20%EB%81%9D.png)
#!/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