Same Variable Assignment

Hi

I have a strange problem:

In my shell script I am performing a copy task:

. prop.txt
cp -r $dir/ $dir/archive

$dir is fetched from a property file (prop.txt) which stores its value

dir=/opt/data

Now the problem is another dir1 comes into picture. I only want to add dir1=<path> in the propertyfile and dont want to change the actual shell script. Is it possible?

Trying to paraphrase what I read/understood:

You want to define a variable dir1=something in your prop.txt file ON TOP of the existing dir definition, both pointing to different locations. Then you want to cp dir 's contents to an archive directory, and cp dir1 's contents to another archive. All this without modifying your above code snippet. Is that correct?

I'm afraid this won't work. You'll need to inform the code that dir1 exists and shoud be used, and, for two actions you'll need two commands (mayhap in a loop, other story).

Please be aware that recursively copying a source directory into an own subdirectory may lead to an infinite loop. Fortunately, this cp is quite clever:

cp: cannot copy a directory, �.�, into itself, �archive/.�