.png)
os: pfSense (nanobsd)
shell: csh
スクリプト:
/etc/rc.conf_mount_rw
mount -t msdosfs /dev/da0s1 /mnt/usb
if ( -s /var/squid/log/access.log ) then
cat /var/squid/log/access.log | perl -p -e 's/^([0-9]*)/"[".localtime($1)."]"/e' > /mnt/usb/access_`date +%Y-%m-%d-%H-%M`.log
echo "Log wurde gespeichert"
else
echo "Logfile ist leer, kein Logfile geschrieben"
endif
/etc/rc.conf_mount_ro
次のエラーが発生します。
/scripts/copy-script.sh: 14: Syntax error: end of file unexpected (expecting "f$ing "fi")
どんな提案がありますか?
答え1
スクリプトの先頭に shebang 行を追加する必要があります。
#!/bin/csh
/bin/csh
これにより、ではなく実行されます/bin/sh
。
エラーはスクリプトですsh
。
答え2
if
fi
ステートメントはで終わらずに終了する必要がありますendif
。