• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Change the path on remote server and export the current directory in a variable from local machine

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

I am connecting the remote machine via ssh to execute one script in that server. My script in some other path than the default one, hence changing the path using cd command and executing the sctipt. This works fine. Now I need to export the current directoty of the remote server after ececuting the cd command during ssh.

Here is the sample code that I am trying.

sss test@remoteserver.com
cd /dir/test/script
./test.sh

To run the test.sh file successfuly, I need to assign the /dir/test/script/ value to one variable from the above script itself. I dont have rights to change the test.sh file itself on remote server as it is provided by thirdparty.
This is how I am trying

sss test@remoteserver.com
cd /dir/test/script
log_dir=`pwd` (Also tried like log_dir='/dir/test/script/')
export $log_dir
echo $log_dir
./test.sh

But my echo is not getting printed. Any suggestion.

Thanks in Advance
 
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

5 seconds test on my cygwin terminal seems to work properly


Best regards,
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. It's "export logdir", not "export $logdir".

2. Shell variable names conventionally are all upper-case. So instead of "logdir", "LOGDIR" is the preferred usage.

 
Ragupathirajan Venkatesan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot !!!
 
I think she's lovely. It's this tiny ad that called her crazy:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic