将下面的脚本保持为 rm-log.sh
#!/bin/sh # to empty all the logs in a directory for i in /var/log/*; do cat /dev/null > $i; done
在命令行执行:
chmod +x ./rm-log.sh sudo ./rm-log.sh
将下面的脚本保持为 rm-log.sh
#!/bin/sh # to empty all the logs in a directory for i in /var/log/*; do cat /dev/null > $i; done
在命令行执行:
chmod +x ./rm-log.sh sudo ./rm-log.sh