Hello, I am a newbie to Unix! I am having a problem trying to read in multiple values and constructing a copy command. It will work when reading in only 1 value from a file (testdata1), but there's an error when attempting to code for multiple values per line. Below are my 2 examples.
This copy command works fine....
while read userid
do
echo "Copy profile to" $userid
copy_command="cp /u/test/.prf_common /u/$userid/.prf_test"
echo $copy_command
$copy_command
done < testdata1
This one returns an error...
IFS=","
while read userid name location
do
echo "Copy profile to" $name "(" $userid ") at" $location
copy_command="cp /u/test/.prf_common /u/$userid/.prf_test"
echo $copy_command
$copy_command
done < testdata2
error:
cpprf[7]: cp /u/test/.prf_common /u/abc/.prf_test: not found.
testdata1
abc
def
testdata2
abc,Al Cooper,New York
def,Don Fields,Chicago
I'm Baffled?!!? Can someone steer me in the right direction here?
Thanks,
Andrew