试图让这个脚本显示数据,导出到文件,然后退出到终端。脚本运行良好,但不会退出。我每次都必须按Ctrl+c。我已经尝试了命令 kill、return 和 exit,但没有成功。感谢任何建议。这让我疯狂。
#!/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