ssh passing and receiving a variable value instead of a file

Fabian

I'm working on a windows with python. My SSH server is a Mindstorm EV3, That is basically an Linux based embedded pc that supports SSH over network. I'm able to connect to the server and download or upload files. My server reads this files with the basic

file.open("filename", "w")

no problem. But isn't there an easier way to pass a value from my computer to my embedded pc other than uploading a file and reading it then out?

How do I send a value using SSH from my windows (python paramiko, PuTTY, etc.) And what do I need to write on my Server to receive this value? (SSH script should be enough, I'll be able to figure out how to do this with python running right there.)

I'm very new to everything containing SSH and passing data over my WiFi. Thank you all for your help !

James Treloar

You can use the system module to do command line arguments. This will allow you to run your code as script.py arg1,arg2,.

This will pass in all the arguments as a list of strings. Also be aware that file name will be passed in as the zeroth element.

This is an example of how to use it.

import sys

for i in sys.argv:
    for j in i:
        print j + '\n'

With an input python s.py foo bar It will print

s
.
p
y
f
o
o
b
a
r

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Bash - Passing value to both console and variable/file

Receiving Promise <Pending> instead of value

Using context variable to name a "section" instead of passing a value

JavaScript function not working when passing variable instead of hard coded value

Argument as variable, instead of directly passing file path, to PowerShell cmdlets

text field receiving optional('value") instead of "value "

value field is not receiving php variable

SSH not passing LANG environment variable

Passing an env variable via ssh

Passing a variable to @Value annotation for reading specific property from properties file

Passing a variable from an external javascript file onto a value in html?

Passing option value to AWS CLI command from variable or file

Passing database value to variable

Passing variable value to URL

Tcl passing value of a variable

Passing variable value into a TextView

Looping through lines in file using bash and passing to variable. Resulting variable is not the same value as file, why?

Is there any way to pass a variable while initializing an enum instead of passing actual value in java?

Passing a value to layout file

Not receiving variable value from service in Angular

Passing a variable using async/await instead of a subscribe

Passing comma separated variable to remote SSH Session

Passing variable definitions to specific shells in ssh

Passing nested quoted variable into a remote ssh command

Variable value not passing through loop

Passing value to an existing variable in makefile

Passing variable value in php array

Variable value passing eeror in openERP

passing input value as session variable