I have an array with files and directories that I wish to add to the compressed tar (tar.gz). Originally I was planning to loop through the array and add each item to the tar, something like that:
tar czf my_app.tar.gz
for app_item in "${app_items[@]}"
do
tar rzf my_app.tar.gz $app_item
done
Running the script I have found that I cannot add files to the compressed tar. I was wondering whether there is any other way of creating a tar from my list of location in the array.
Any help would be greatly appreciated!