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
storing result of a command in variable eltinator Shell Programming and Scripting 1 04-17-2008 08:09 PM
How to get a result of a cmd into variable? manchau UNIX and Linux Applications 1 03-06-2008 07:36 AM
Problem storing SSH result in a variable prash184u Shell Programming and Scripting 1 01-17-2008 04:41 PM
cree a variable from a commande result kykyboss Shell Programming and Scripting 3 11-13-2006 10:51 AM
Setting a variable to result of FIND command JP Favara Windows & DOS: Issues & Discussions 2 03-09-2005 10:17 PM

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 Rating: Thread Rating: 2 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 02-19-2007
hcclnoodles hcclnoodles is offline
Registered User
  
 

Join Date: Mar 2002
Posts: 272
populate variable from remote result

Hi there

i am trying to pass the result of a remote command into a variable into my script

ie
Code:
#!/bin/sh

var = `ssh remote_box 'uname'`
echo $var
but all i get back is

Code:
./script.sh[3]: var:  not found

However when i add a -x to put it into diag mode i get the following

Code:
+ ssh remote_server uname
+ var = SunOS
./script[3]: var:  not found
+ echo
so it looks like the variable var is actually being populated but i cant echo it


does anybody know what im doing wrong here?

Cheers
Gary
  #2 (permalink)  
Old 02-19-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Remove the spaces before and after equal sign
Code:
var=`ssh remote_box 'uname'`
  #3 (permalink)  
Old 02-19-2007
hcclnoodles hcclnoodles is offline
Registered User
  
 

Join Date: Mar 2002
Posts: 272
doh !! thankyou
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 12:57 PM.


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