Sat Oct 20, 2012 12:50 pm
Sun Oct 21, 2012 1:06 am
Say i want to run one command ("rsync") for a few directories.
Instead of running it again and again:
couldn't i put Documents, Programming and Pictures in an array, and the loop thru the array?
Sun Oct 21, 2012 1:29 am
--files-from=FILE read list of source-file names from FILE
Sun Oct 21, 2012 1:55 pm
Sun Oct 21, 2012 7:42 pm
mylist=(
tmp/
tmp2
)
rsync -avx ${mylist[@]} tmp3/
Tue Oct 23, 2012 12:37 am
fsmithred wrote:
- Code:
mylist=(
tmp/
tmp2
)
rsync -avx ${mylist[@]} tmp3/
tmp3 then contains copies of the files that are in tmp/ (without copying that folder,
and a copy of tmp2 with its contents.
So yeah, you can make it an array, and you can put one item per line, so it's easy to edit.
#######################
function backup_private {
rsync -auv --delete ${HOME_LIST[@]} $BU_HOME
}
#####################
function etc_backup {
rsync -auv --delete ${ETC_LIST[@]} $BU_ETC
}