One more problem with script

When I put this in my script, it didn't work right

# Change the ownership
chown_command=""
for tmp in $tempvar
do
chown_command="${chown_command}=chown $UID $tmp;"
done

for server3 in $list
do
ssh -q $id@$server3 "${chown_command}"
echo "Changing ownership on $server3"
echo " "
done

When it goes down the sever list, and comes to

ssh -q $id@$server3 "${chown_command}"

Instead of running the "${chown_command}"

It just puts me at a prompt, I just want it to run the chown command!

+ chown_command=
+ ssh -q id@serverx
d@serverx:~>
accessid@serverx:~>
accessid@serverx:~> exit
logout
+ echo Changing ownership on x
Changing ownership on x
+ echo

If you see, in the bolded area, it makes me type exit - and it doesn't work. what's going on????

Syndex,
What is the value of "tempvar"?

tmpvar="/tmp/{$USER}uid.tmp

It's where the file location is, where the user owns which files etc.

Syndex,
Try to display 'chown_command' right after the first 'for' loop:

echo 'chown_command = '$chown_command

Use parentheses instead of braces, try:

ssh -q $id@$server3 "$(chown_command)"

instead of:

ssh -q $id@$server3 "${chown_command}"

Regards