ファイルの予期しない enf ("f$ing"fi" を除く)

ファイルの予期しない enf (
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

おすすめ記事