Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread Robert Nichols
On 05/28/2014 09:58 AM, Elias Persson wrote: > On 2014-05-28 15:40, Robert Nichols wrote: >> On 05/28/2014 07:10 AM, Elias Persson wrote: >>> On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash >>> > tar cfz `date +%F`_$NAME.tar.gz web$NR/ >>> >>> 3. Your `tar` stanza is wrong (if

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread m . roth
Elias Persson wrote: > On 2014-05-28 15:35, m.r...@5-cent.us wrote: >> Elias Persson wrote: >>> On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash > tar cfz `date +%F`_$NAME.tar.gz web$NR/ > >>> >> Dumb question: why not > >> tar -czf /backup/www/test/`date +%F`_$NAME.t

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread Elias Persson
On 2014-05-28 15:35, m.r...@5-cent.us wrote: > Elias Persson wrote: >> On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash >>> tar cfz `date +%F`_$NAME.tar.gz web$NR/ >> > Dumb question: why not > tar -czf /backup/www/test/`date +%F`_$NAME.tar.gz web$NR/ >> A few things: >

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread Leon Fauster
Am 28.05.2014 um 15:35 schrieb m.r...@5-cent.us: >> 3. 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? Best practice -> readability. -- LF ___

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread Elias Persson
On 2014-05-28 15:40, Robert Nichols wrote: > On 05/28/2014 07:10 AM, Elias Persson wrote: >> On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash >>> tar cfz `date +%F`_$NAME.tar.gz web$NR/ >> >> 3. Your `tar` stanza is wrong (if it's not obvious to you why that is, >> now is

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread Robert Nichols
On 05/28/2014 07:10 AM, Elias Persson wrote: > On 2014-05-25 12:08, Paolo De Michele wrote:> !/bin/bash > > tar cfz `date +%F`_$NAME.tar.gz web$NR/ > > 3. 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 >

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread m . roth
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/ > > >

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread Elias Persson
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

Re: [CentOS] bash script reading directory with while and do

2014-05-28 Thread Alberto Varesio
Yes! PATH should be a reserved name, NOT to be used as a variable in scripts. btw, what errors do you get running the script ? On Tue, May 27, 2014 at 11:44 PM, Darr247 wrote: > On 26 May 2014 @09:12 zulu, Alberto Varesio wrote: > > you are overwriting the PATH env variable. > > change PATH t

Re: [CentOS] bash script reading directory with while and do

2014-05-27 Thread Darr247
On 26 May 2014 @09:12 zulu, Alberto Varesio wrote: > you are overwriting the PATH env variable. > change PATH to CLIPATH and all will work I don't understand, too... do you mean the script should read !/bin/bash while read line; do read NR CLIPATH NAME<<<$(IFS=" "; echo $line)

Re: [CentOS] bash script reading directory with while and do

2014-05-27 Thread Paolo De Michele
Hi, I don't understand the procedure so, in theory the path should be /var/www/clients/client* (I have number from 1 to X) I replaced the PATH in read section It's correct? On 05/26/2014 11:12 AM, Alberto Varesio wrote: > Hi > you are overwriting the PATH env variable. > change PATH to CLIPATH

Re: [CentOS] bash script reading directory with while and do

2014-05-26 Thread Alberto Varesio
Hi you are overwriting the PATH env variable. change PATH to CLIPATH and all will work On Sun, May 25, 2014 at 12:08 PM, Paolo De Michele wrote: > hi everyone, > > I'm searching to do a functionally bash script for copy many file inside > in a directory > the scenario is: > > root path= /var/www

[CentOS] bash script reading directory with while and do

2014-05-25 Thread Paolo De Michele
hi everyone, I'm searching to do a functionally bash script for copy many file inside in a directory the scenario is: root path= /var/www/clients/ inside of this there are many subdirectories with this name: client1 to x (depends of the customer) it happens that a customer not renew the contract