The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with csh script rahulrathod Shell Programming and Scripting 4 02-21-2008 12:38 PM
script problem tdavenpo Shell Programming and Scripting 3 01-04-2006 04:07 PM
Problem starting a script from a 'main'-script Rakker UNIX for Dummies Questions & Answers 3 06-28-2005 08:12 AM
problem with a script Lestat Shell Programming and Scripting 4 06-13-2005 12:30 PM
problem with ftp script...please help vancouver_joe UNIX for Advanced & Expert Users 2 11-22-2001 07:47 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-11-2007
syndex syndex is offline
Registered User
  
 

Join Date: Jun 2007
Location: Pennsylvania
Posts: 46
Angry 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????
  #2 (permalink)  
Old 07-11-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Syndex,
What is the value of "tempvar"?
  #3 (permalink)  
Old 07-11-2007
syndex syndex is offline
Registered User
  
 

Join Date: Jun 2007
Location: Pennsylvania
Posts: 46
Quote:
Originally Posted by Shell_Life View Post
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.
  #4 (permalink)  
Old 07-11-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Syndex,
Try to display 'chown_command' right after the first 'for' loop:
Code:
echo 'chown_command = '$chown_command
  #5 (permalink)  
Old 07-11-2007
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,294
Use parentheses instead of braces, try:

Code:
ssh -q $id@$server3 "$(chown_command)"
instead of:

Code:
ssh -q $id@$server3 "${chown_command}"
Regards
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0