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


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Operating Systems Linux SuSE "ssh suse-server 'python -V' > python-version.out" not redirecting
# 1  
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 10:51 PM..
# 2  
Try 2> instead of>.
This User Gave Thanks to elixir_sinari For This Post:
# 3  
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  
Try using -t option - Force pseudo-tty allocation
Code:
ssh -t suse-server 'python -V' > python-version.out

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #711
Difficulty: Easy
The earliest computing machines had fixed programs.
True or False?

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. Programming

In Python, what does "x = 5" really do/mean?

Hi, I'm a great scripter, but just learning programming (using Python). I'm very much a newbie at this, so please be patient as I'm sure these will seem so basic a questions and may seem stupid to those experienced. I'm reading a python book right now that has me thinking about variables.... (2 Replies)
Discussion started by: Narnie
2 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

Featured Tech Videos