我在test2文件夹中生成pcap文件时编写了以下脚本以将csv文件保存在testcsv2文件夹中
inotifywait -m /home/tejas/Desktop/test2 -e create |
while read path action file; do
echo "The file '$file' appeared in dictionary '$path' via '$action'"
tshark -r $file -T fields -E separator=, -E occurrence=f -e frame.time_epoch -e wlan.ta -e tzsp.wlan.signal > /home/tejas/Desktop/testcsv2/output.csv
done
但是,当我从终端运行tshark脚本时,它运行正常,但是当我运行此脚本时,它会创建一个空文件。可能有什么不对?
编辑:创建文件时发生以下事件
/home/tejas/Desktop/test2/ OPEN test_00052_20160830191016.pcap
/home/tejas/Desktop/test2/ MODIFY test_00052_20160830191016.pcap
/home/tejas/Desktop/test2/ OPEN,ISDIR
/home/tejas/Desktop/test2/ ACCESS,ISDIR
/home/tejas/Desktop/test2/ OPEN,ISDIR
/home/tejas/Desktop/test2/ CLOSE_NOWRITE,CLOSE,ISDIR
/home/tejas/Desktop/test2/ ACCESS,ISDIR
/home/tejas/Desktop/test2/ ACCESS,ISDIR
/home/tejas/Desktop/test2/ ACCESS,ISDIR
/home/tejas/Desktop/test2/ CLOSE_NOWRITE,CLOSE,ISDIR
/home/tejas/Desktop/test2/ MODIFY test_00052_20160830191016.pcap
/home/tejas/Desktop/test2/ MODIFY test_00052_20160830191016.pcap
/home/tejas/Desktop/test2/ MODIFY test_00052_20160830191016.pcap
/home/tejas/Desktop/test2/ MODIFY test_00052_20160830191016.pcap
/home/tejas/Desktop/test2/ CLOSE_WRITE,CLOSE test_00052_20160830191016.pcap