創建x.sh文件,編輯
在/var/log/下查找log文件,複製文件到/home/omc/ftl且把結果保存到/home/omc/ftl/logs.txt文件中
[root@localhost log]# find /var/log/*.log -type f | xargs -i cp {} /home/omc/ftl
[root@localhost log]# ll -ltr /home/omc/ftl
[root@localhost log]# find /var/log/*.log -type f > /home/omc/ftl/logs.txt
[root@localhost log]# ll /home/omc/ftl/logs.txt
刪除 /home/omc/ftl/下的log文件
[root@localhost ftl]# ll *.log |xargs rm -rf {} 【錯誤】
[root@localhost ftl]# ls *.log |xargs rm -rf {} 【正確】