Reputation: 29
I have this command :
echo rm $(find "$SD" -type f -mtime "+$MT" -name "*.$TY" -print ) >> ${LOGFILE}
and it prints
rm /u01/oradata/logs/dwf_monitor_datafile.dbf.gz /u01/oradata/logs/dws_monitor_datafile.dbf.gz /u01/oradata/logs/dwd_monitor_datafile.dbf.gz
I want it to instead print
rm /u01/oradata/logs/dwf_monitor_datafile.dbf.gz
rm /u01/oradata/logs/dws_monitor_datafile.dbf.gz
rm /u01/oradata/logs/dwd_monitor_datafile.dbf.gz
How, thanks in adcance.
Upvotes: 1
Views: 43
Reputation: 113884
If you actually want to delete the files, you should use find's -delete
command. If you are just trying to display nice-looking output, then try:
find "$SD" -type f -mtime "+$MT" -name "*.$TY" -exec echo rm {} \; >>${LOGFILE}
Upvotes: 3