"ssh suse-server 'python -V' > python-version.out" not redirecting


 
Thread Tools Search this Thread
Operating Systems Linux SuSE "ssh suse-server 'python -V' > python-version.out" not redirecting
# 1  
Old 02-13-2013
Question "ssh suse-server 'python -V' > python-version.out" not redirecting

Okay, so I have had this problem on openSUSE, and Debian systems now and I am hoping for a little help. I think it has something to do with Python but I couldn't find a proper Python area here.

I am trying to redirect the output of "ssh suse-server 'python -V'" to a file. It seems that no matter what I try, it always prints to stdout. Here is an example of what I am doing.

Code:
user@suse-envy4t:~> ssh suse-server 'python -V' > python-version.out 
not a terminal
Python 2.7.3
user@suse-envy4t:~> cat python-version.out
user@suse-envy4t:~> ssh suse-server 'python -V' | tee  python-version.out 
not a terminal
Python 2.7.3
user@suse-envy4t:~> cat python-version.out

Now, I realize that I could just log into the box and do this but I have a lot of systems to do this on. I want to to rap this in a forloop and so I can get a list of what version of python all the boxes have on them... not being able to capture the output of "python -V" is really making this a pain. I hope this is something stupid that I am doing wrong but "ssh suse-server 'cat /etc/issue'" can redirect just fine with >, >>, or tee... so I don't know what I am doing wrong.

Last edited by jim mcnamara; 02-13-2013 at 09:51 PM..
# 2  
Old 02-13-2013
Try 2> instead of>.
This User Gave Thanks to elixir_sinari For This Post:
# 3  
Old 02-13-2013
Well there we go!

user@suse-envy4t:~> ssh suse-server 'python -V' 2> python-version.out
user@suse-envy4t:~> cat python-version.out
not a terminal
Python 2.7.3

So, I guess it is not using stdout to report the version.... weird, but it works. Thanks for the help Smilie
# 4  
Old 02-13-2013
Try using -t option - Force pseudo-tty allocation
Code:
ssh -t suse-server 'python -V' > python-version.out

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Python : Problem with " TypeError: float() argument must be a string or a number "

Hello ! I'm creating a CGI which allow to display graph from some data. The datas looks like : 2020-01-13-00-00,384.00,350.00 2020-01-13-06-00,384.00,350.00 2020-01-13-12-00,384.00,350.00 2020-01-13-18-00,384.00,350.00 2020-01-14-00-00,384.00,350.00... (1 Reply)
Discussion started by: Tim2424
1 Replies

2. Programming

[Python] replicating "sha256 -C checksum_file.txt file.txt"

Hello everyone, Since my python knowledge is limimted, I've challenged myself to learn as much as possible to help me with my carrere. I'm currently trying to convert a shell script to python, just to give myself a task. There is one section of the script that I'm having issues converting and... (2 Replies)
Discussion started by: da1
2 Replies

3. Programming

Obfuscated "Hello World!" in Python 2.7.x...

Obfuscated Hello World! in Python 2.7.x This is seriously impressive:- Obfuscating "Hello world!" - Ben Kurtovic (2 Replies)
Discussion started by: wisecracker
2 Replies

4. Shell Programming and Scripting

Unable to store "python --version" to a shell variable

Hi All, I need to get the version of python installed and store it in a variable for later use. Whereas it is printing on the console instead of storing to variable. I am able to store output of ls command in a variable. Please check the below code : root@myhost:/volumes/srini# cat... (4 Replies)
Discussion started by: srinivasan.neel
4 Replies

5. UNIX for Dummies Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

Please can you help me understand the significance of providing arguments under sh -s in > ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Discussion started by: Sree10
4 Replies

6. Shell Programming and Scripting

Python 2.5 / 2.2 import "errno" fails on AIX Server

I am trying to import the "xmlrpclib" Module from Activepython 2.5 in einer older Python 2.2. Already achived this on a SUSE Linux server, but I am now required to do it on a AIX server. Resolved the first few error messages by copying files from Activepython to Python but I can't get the... (0 Replies)
Discussion started by: frieling
0 Replies

7. HP-UX

Unable To Perform A "Passwordless" SSH Login To A Server

Greetings! I am trying to perform a passwordless SSH login from a HPUX 11.31 client to a HPUX 11.31 server. Whenever I do a "ssh -l root serverA" from the client, I am prompted for a password. Giving the password, I am able to successfully login. However I am trying to accomplish a... (9 Replies)
Discussion started by: Rob Sandifer
9 Replies

8. AIX

"pconsole" and "esaadmin" on AIX version 6

Anyone know what is the function of user "pconsole" and "esaadmin" on AIX version 6? (1 Reply)
Discussion started by: ebab3
1 Replies

9. AIX

SSH has this error: "server refused our key"

I did successful yestday as Porter's doc: 1. Create private/pub key on AIX: $ssh-keygen -t identity 2. Get my private key from the AIX server, found in $HOME/.ssh/identity Put that on Windows box. I use WinSCP to transfer private key from AIX to Windows 3. Run puttygen.exe and... (8 Replies)
Discussion started by: rainbow_bean
8 Replies
Login or Register to Ask a Question