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.

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 05-07-2008
jbmukund jbmukund is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
ececute scrtipt over ssh

Hi all,

I have a script which I want to launch from on a remote machine.
I tied to do this.

I have 2 requirement
1) To retain the "BUILDDIR" value when connected to SSH of sna3.
2) execute a script 'test.sh' present in my local directory on remote sna3 machine.

If I am using Single Quotes, I am not able to retail the BUILDDIR value.

MAIN Script file:
BUILDDIR=$PWD
ssh sna4 "
echo pwd;
echo test.script --------------------------
./test.sh
"

How do I do this

Mukund Jampala
  #2 (permalink)  
Old 05-07-2008
hemangjani hemangjani is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 73
Smile

Hello,

If I understand the question correctly, you need to export the variable using the 'export' command.

Is that what are you trying to do?
  #3 (permalink)  
Old 05-07-2008
ungnown.admin ungnown.admin is offline
Registered User
  
 

Join Date: May 2008
Posts: 2
Hi

1) Unless you include the variable in a script run on the remote machine it won't be used. You are creating the variable locally, so the remote machine won't be aware of it.

2)The script won't be run the way you have things formatted. You have the command to run test.sh in double quotes. Scripts don't execute if they're in double quotes because the shell will see them as just text. If you want to echo text to the screen, just put the commands in the script. Then run
ssh sna4 test.sh

Hope this helps.
Todd
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 05:59 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