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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-19-2008
hcclnoodles hcclnoodles is offline
Registered User
  
 

Join Date: Mar 2002
Posts: 272
running command remotely to populate local variable

If I run this

Code:
[root@central-server] # ssh remote-server 'du -sk /usr/platform/`uname -i`/'
174     /usr/platform/SUNW,Sun-Fire-V245
I get my output just fine,

However, if i try to do the same but populate a local variable within my script called for example 'result'

Code:
#!/bin/ksh

result=`ssh remote-server 'du -sk /usr/platform/`uname -i`/'`
echo $result
I get

Code:
[root@central-server] # ./test.sh 
./test.sh[13]: /: cannot execute
./test.sh[13]: -i:  not found
It looks like the `uname -i` is not getting run remotely, does anybody know how I can get this to be recognised by the remote box ?

Any help would be great

Cheers