Re: bash script reading directory with while and do

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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 and all will work
>
>
> On Sun, May 25, 2014 at 12:08 PM, Paolo De Michele
> <paolo@xxxxxxxxxxxxxxxxx>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/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 and I would stopping
>> to do a backup directory for him.
>>
>> this operation should be versatile and very easy
>> so, I don't understand the error in this script. look below:
>>
>> !/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
>>
>> anyone can help me, please?
>> thanks in advance
>>
>> regards
>> _______________________________________________
>> CentOS mailing list
>> CentOS@xxxxxxxxxx
>> http://lists.centos.org/mailman/listinfo/centos
>>
>
>

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux