The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-01-2007
aigles's Avatar
aigles aigles is offline
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,212
Quote:
Originally Posted by syndex View Post
#Grab information
for abcdefg in `echo $server1`
do
ssh -q $id@$abcdefg zaquid="sudo cat /etc/passwd | grep $user1 | cut -f3 -d ":""; primgroup="`id -Gn $user1`"

#debugging - test the variables.
echo $abcdefg
echo $zaquid
echo $primgroup
echo $grouplist
echo $server1
done
Try something like that (not tested):
Code:
server1=$(echo $server1)
zaquid=$(ssh -q $id@$server1 "id -u $user1")
primgroup=$(ssh -q $id@$server1 "id -gn $user1")
grouplist=$(ssh -q $id@$server1 "id -Gn $user1")
Quote:
Originally Posted by syndex View Post
function tmplist {
for tmp in $tmpvar
do
chown $UID $tmp
done
}

# Change the ownership
for server3 in $list
do
ssh -q $id@$server3 "`tmplist`"

done
Try (not tested) :
Code:
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}"
done
Reply With Quote