从 shell 脚本 transfer.sh 中粘贴了一段代码
if [[ ${ld} -eq ${eld} ]] ; then
mv "$file1" "$FILESNEW/."
if [ $? -ne 0 ]; then
echo "Move Command Failed-File ${fspec}"
fi
echo "File ${fspec} Sucessfully Moved to ready directory "
else
echo "File ${fspec} line count mismatch: ${lc}/${elc}"
fi
当我执行 ./transfer.sh 移动命令时等待提示“override protection y/n” 我不希望在执行移动命令时出现此提示。我怎样才能摆脱它?
最佳答案
使用 mv -f
。选项 -f 覆盖任何提示(“force”)。
-f, --force
do not prompt before overwriting
关于linux - 关于 UNIX 移动命令覆盖保护,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2331388/