这是我的脚本,我正在尝试重命名文件夹中的文件。
rename1.sh
----------
#!/bin/bash
cd /home/lanein1/WestonIN7pm/"$(date +%Y-%m-%d)" && rename s/WestonIN/WestonIN7pm/ *.jpg
cd /home/lanein1/WestonOUT7pm/"$(date +%Y-%m-%d)" && rename s/WestonOUT/WestonOUT7pm/ *.jpg
这是我得到的错误:
can't cd to /home/lanein1/scripts/rename1.sh
我不明白为什么会出现此错误
克朗条目:
29 12 * * * cd /home/lanein1/scripts/rename1.sh >> /home/lanein1/scripts/rename2.log 2>&1
答案1
您要求将目录更改为脚本:
cd /home/lanein1/scripts/rename1.sh >> /home/lanein1/scripts/rename2.log 2>&1
也许你想运行它:
/home/lanein1/scripts/rename1.sh >> /home/lanein1/scripts/rename2.log 2>&1