Apologies if I’m kind of a bash novice!
I’ve created a backup script that works fine. However, I want to simplify it a bit, by either reading and inserting a list of files into
rsync or reading the list of files from another script file into
Reason being so I can easily change the list of files without rewriting the script. As right now I have all the list of files written in each rsync command.
This is basically what I have written now
# !/bin/bash bakdir = ~/backup mkdir -p $bakdir mkdir -p "$bakdir"/Documents cd ~/Documents rsync -a --progress Document1.doc Document2.doc "$bakdir"/Documents mkdir -p "$bakdir"/Stuff cd ~/Stuff rsync -a --progress Folder1 MyApp.app Document.doc "$bakdir"/Stuff
What I want to achieve
mkdir -p "$bakdir"/Documents cd ~/Documents list1= Document1.doc Document2.doc rsync -a --progress $list1 "$bakdir"/Documents mkdir -p "$bakdir"/Stuff cd ~/Stuff list2= Folder1 MyApp.app Document.doc rsync -a --progress $list2 "$bakdir"/Stuff
Tried searching for a question similar to this and can’t find anything.
Thank you in advance.