Elias Persson wrote:
On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash
while read line; do read NR PATH NAME<<<$(IFS=" "; echo $line)
cd /var/www/clients/ cp -R $PATH /backup/temp/www/ cd /backup/temp/www/ tar cfz `date +%F`_$NAME.tar.gz web$NR/ mv *.tar.gz /backup/www/test/ rm -rf /backup/temp/www/*
done < sites.txt
Dumb question: why not while read line; do read NR PATH NAME<<<$(IFS=" "; echo $line) cd /var/www/clients/ tar -czf /backup/www/test/`date +%F`_$NAME.tar.gz web$NR/ done < sites.txt
A few things:
<snip>
- Your `tar` stanza is wrong (if it's not obvious to you why that is, now is a good time to make a habit of using long options (e.g. `--gzip`) whenever possible).
Why long? <snip> mark