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
. . .