![私の簡単なスクリプトで何が起こっていますか? [閉鎖]](https://linux33.com/image/45205/%E7%A7%81%E3%81%AE%E7%B0%A1%E5%8D%98%E3%81%AA%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%81%A7%E4%BD%95%E3%81%8C%E8%B5%B7%E3%81%93%E3%81%A3%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F%20%5B%E9%96%89%E9%8E%96%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
[