0
プロジェクトディレクトリをバックアップするためのbashスクリプトを作成しましたが、除外オプションは機能しません。bashスクリプトでrsyncからディレクトリを除外できない
backup.sh
#!/bin/sh
DRY_RUN=""
if [ $1="-n" ]; then
DRY_RUN="n"
fi
OPTIONS="-a"$DRY_RUN"v --delete --delete-excluded --exclude='/bin/'"
SOURCE="/home/vikram/Documents/sem4/oop/lab/java_assignments/student_information_system/"
DEST="/home/vikram/Documents/sem4/oop/lab/java_assignments/student_information_system_backup"
rsync $OPTIONS $SOURCE $DEST
私は端末に個別のコマンドを実行しています、それが動作します。
vikram:student_information_system$ rsync -anv --delete --delete-excluded --exclude='/bin/' /home/vikram/Documents/sem4/oop/lab/java_assignments/student_information_system/ /home/vikram/Documents/sem4/oop/lab/java_assignments/student_information_system_backup
sending incremental file list
deleting bin/student_information_system/model/StudentTest.class
deleting bin/student_information_system/model/Student.class
deleting bin/student_information_system/model/
deleting bin/student_information_system/
deleting bin/
./
.backup.sh.swp
backup.sh
backup.sh~
sent 507 bytes received 228 bytes 1,470.00 bytes/sec
total size is 16,033 speedup is 21.81 (DRY RUN)
vikram:student_information_system$
ところで:[ "N" $ 1 =]'置き換えます。 – Cyrus