![내 간단한 스크립트에 무슨 일이 일어나고 있나요? [폐쇄]](https://linux55.com/image/45205/%EB%82%B4%20%EA%B0%84%EB%8B%A8%ED%95%9C%20%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8%EC%97%90%20%EB%AC%B4%EC%8A%A8%20%EC%9D%BC%EC%9D%B4%20%EC%9D%BC%EC%96%B4%EB%82%98%EA%B3%A0%20%EC%9E%88%EB%82%98%EC%9A%94%3F%20%5B%ED%8F%90%EC%87%84%5D.png)
#!/bin/bash
while read file1; do
while read file2 : do
if [ $file1 == $file2 ] ; then
$file1 >> /infanass/dev/admin/test/newlist.txt
fi
echo "$file1"
echo "$file2"
done < /infanass/dev/admin/test/file2.txt
done < /infanass/dev/admin/test/file1.txt
실수:
./test.bsh: line 9: syntax error near unexpected token `done'
./test.bsh: line 9: ` done 3</infanass/dev/admin/test/file2.txt'
답변1
3번째 줄에는
while read file2 : do
읽어야 해
while read file2 ; do
따라서 while 루프의 구문은 유효합니다.
참고 사항: 이전 버전을 사용하고 있으므로 명령 이 중단 되지 [
않도록 인용 부호 와 변수를 [[
사용해야 합니다 .file1
file2
pathname expansion
word splitting
[