今天调试脚本发现如下错误,经过研究主要原因如下
问题描述
[root@single shareplex_health_check]# find ${v_dir_name}/ -name '${log_name}*' -mtime +3 –exec rm –rf {} \;
find: paths must precede expression:
解决
(1)-name后如果查找多个文件时,需要使用单引号; (2)如果使用*通配符,则需要使用单引号括起来或者使用\进行转义 (3)–exec前面横线使用的是中文格式的横线,格式不正确需要使用英文减号
正确如下
[root@single shareplex_health_check]# find splex_check_log/ -name 'shareplex_check_report*' -mtime +1 -exec rm –f {} \;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31439444/viewspace-2672933/ ,如需转载,请注明出处,否则将追究法律责任。