Background info:
Local machine : Linux, /bin/bash
Remote machine (for the user used for ssh) : SunOs, /bin/ksh
(so we have different OS, different Shells)
My problem :
From the local host i execute
So, as you can see I want to open a ssh session on a remote machine and a want to shift a variable there also (in my case variable $var ). From what I know I can only do that by using the syntax : ssh user@machine " command " , so I used double quotes to describe the commands which I wanna execute via ssh. So, from my example you can see that I can shift the $var variable on the remote session, but I cannot create and/or call (?) another variable $var2 .
If I use ' ' (simple quotes) instead of " " . I can create the variable $var2 , but I cannot shift the variable $var :| .
I tried the same thing when the remote machine was Linux with /bin/sh shell for the user used for ssh. The results are the same, so I don't think it is an issue of different OS or different shells
Any ideas?
P.S. : i dont want to use workarounds such as declare $var in a file, scp the file on the remote host and source it there.
To explain why that's needed, type this into your shell:
...which of course doesn't execute 'echo $LINE'. But you see the problem: ssh doesn'g even get 'echo $LINE', it gets 'echo', because the shell helpfully substitutes $LINE for you before it's even fed to the command -- in this case echo, in your case ssh...
I have a new problem related with the one above (we still have same background info from the 1st post) :
So the variable $value is not set.
I've also tried the remote eval command this way:
With the same result.
So I basically want to create (while I'm in a remote ssh session) the variable value. $value should take the content of the variable h3mis391_telnet (which was set in the initial session, before ssh).But I need to call the variable h3mis391_telnet using variable $i (set after ssh). I wanna use the value of $i variable to create the name of the $h3mis391_telnet, and this name I wanna use in order to call the variable in the eval command.
The idea it;s a bit complicated but the code shouldn;t be hard to understand.
Any help regarding the suntax I use or different approach to accomplish what I want?
---------- Post updated at 05:38 AM ---------- Previous update was at 05:25 AM ----------
To be more clear, this is what I want but done in only one session , without ssh :
So this way it works. The only difference is that I want
------------------------------------> to use ssh in this point
You do know telnet is a reserved word (since its a command...) don't you?
It is maybe time to get to good practice: Use UPPERCASE for Variables! then it will not be misunderstood...
(Depending on what display I am I do not see underscores...)
Hello I am writing a script in a local machine, i am using ssh, here i am not able to using back ticks & input file to while loop. here is my script
ssh -q server1
a=`ps -ef | grep ccms | awk {print $1}`
b=`ps -ef | grep mss | awk {print $1}`
# above lines are not working, so i redirected... (12 Replies)
How to execute a script in remote machine through ssh
I have a script test.sh which does some backup activity in remote machine. Wanted to keep backup also in remote machine.
ssh -l username <remote machine> "commands to be exceuted as ; separted"
but how to put the script in the place of... (5 Replies)
I want to SSH to 192.168.1.15 Server from my machine, my ip was 192.168.1.99
Source Destination was UP, with IP 192.168.1.15.
This is LAN Network there are 30 Machine's Connected to the network and working fine, I'm Playing around the local machine's because I need to apply the same rules in... (2 Replies)
how to use ssh to run shell script on a remote machine?
ssh user@remote sh ./script.unx
i ran the above command
./script.unx HAS NOHUP COMMAND IN ITS BODY, I AM GETTING ERROR AS NOHUP NOT FOUND...
i tried to run that script from remote server, its working fine
do ineed to set... (6 Replies)
Hi Folks,
I want to create VNC session on the Remote RHEL machine on which ssh access is denied. Is there any way so that I can create VNC session without ssh access. Let me know all possible ways! (1 Reply)
Hi All,
i have two machines like x and y . my requirement is i should connect to machine Y from x through ssh connection . and do some operation such as copy and move and delete files in Y machine .
i tried with this code but it is doing in machine x only . and i need to exit from Y when... (1 Reply)
Hi all,
Really hope someone can help me, i have been trying lots of things and just cant seem to nail it - and for something that seems straight forward....
Anyway, scenario is I need to log onto a second machine (remote server) from main workstation. Once logged in I need to run a batch... (2 Replies)
For a few days now I have been experiencing issues when trying to SSH into 1 of my machine. I get the following output when running 'ssh -vvv':
server1:/home/mymadq> ssh -l root -vvv server2
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config... (3 Replies)
Hi!
I have two solaris 10 machines(say 10.1.1.1,10.1.1.2). i have installed rsync on 10.1.1.2,
10.1.1.1:::
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash-3.00$ ssh 10.1.1.2 "echo $PATH"
Password:... (4 Replies)
I am trying to search and remove files from a list of servers. I want to find every occurence of this file on each machine and then remove it. If I execute the find command on the remote machine I would like to be able to pipe the output to xargs and remove the file. Does anyone know hat would be... (1 Reply)