else
then
files1=$(find /root/Documents/actualBACKUPpath/co* -type f | wc -l)
if [ $files1 = 6 ];
then
rm -rv /root/Documents/folder6astmp/co*
cp -v /root/Documents/actualBACKUPpath/co*
/root/Documents/folder6astmp/
rm -rv /root/Documents/actualBACKUPpath/co*
echo other day operation success with actual backup path
else
files2=$(find /root/Documents/folder6astmp/co* -type f | wc -l)
if [ $files2 = 6 ];
then
echo we have nothing to do in tmp directoy success
fi
fi fi
当我执行上述代码时,我得到的输出是
find: ‘/root/Documents/actualBACKUPpath/co*’: No such file or
directory
we have nothing to do in tmp directory success
它按预期正常工作,但为什么find:'/root/Documents*
会打印该声明?
答案1
我的猜测是,在目录 /root/Documents/actualBACKUPpath 中没有与模式“co*”匹配的文件,并且 cp 命令对此表示抱怨。
尝试使用 -vx 选项运行该脚本,让它显示它正在做什么:
bash -vx scriptname
或者在脚本第一行的脚本声明中添加相同的选项(暂时):
#! /bin/bash -vx
. . .