試圖讓這個腳本來顯示數據,導出到文件,然後退出到終端。腳本運行正常,但不會退出。我必須每次都按Ctrl + c。我嘗試了kill,return和exit這兩個命令,但都沒有成功。欣賞任何建議。這讓我瘋狂。退出bash腳本到終端
#!/bin/bash
#Script that displays data about current directory.
echo
echo -n "Number of subdirectories in this directory: "
find . -type d | wc -l
sleep 2
echo
echo -n "List of files in the current directory: "
ls -1 | wc -l
sleep 2
echo
echo "List of zero-length files in current directory: "
find -size 0
sleep 2
echo
echo "Used storage space of the current directory is: "
du -sh
sleep 2
echo
echo -n "Data output of 'dirchk.sh' is in this directory called directory-check.results."
./dirchk.sh > directory-check.result