Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
清理脚本:
. $HOME/u0146121 find $HOME/OldLogFiles/ -type f -mtime +7 -delete
我删除了 7 天或更早的文件,但现在我想记录我删除的内容。我必须使用管道吗?我是shell脚本的初学者。
未经测试
log=$HOME/OldLogFiles/deleted.log.$(date +%Y%m%d%H%M%S) find $HOME/OldLogFiles/ -type f -mtime +7 -delete -print > "$log"