发布网友 发布时间:2022-02-26 11:17
共1个回答
热心网友 时间:2022-02-26 12:46
用脚本备份更安全#!/bin/bash# Backup text fileif cd /text ; then if [ -f txt_lock ]; then/bin/echo "Backup already running."exit 0 else/bin/touch txt_lockif [ -f a.bck.1 ]; then /bin/mv -f a.bck.5 a.bck.6 /bin/mv -f a.bck.4 a.bck.5 /bin/mv -f a.bck.3 a.bck.4 /bin/mv -f a.bck.2 a.bck.3 /bin/mv -f a.bck.1 a.bck.2else /bin/touch a.bck.2 /bin/touch a.bck.3 /bin/touch a.bck.4 /bin/touch a.bck.5 /bin/touch a.bck.6fi/bin/cp a.txt a.bck.1/bin/rm -f txt_lock fielse /bin/echo "Error changing directory to /text"fi