os.system dual behaviour

I

iu2

Hi guys

I do

os.system('ls &> e')

On one linux machine it emits ls output to the file e as expected.
On another linux machine it emits ls to the standard output, and
nothing to e!
Both machines run Fedora linux.

The command "ls &> e" entered at the shell (no python) behaves ok on
both machines.

Why?? How can I solve this?

Your help will be appreciated.
 
E

Emile van Sebille

iu2 said:
Hi guys

I do

os.system('ls &> e')

On one linux machine it emits ls output to the file e as expected.
On another linux machine it emits ls to the standard output, and
nothing to e!
Both machines run Fedora linux.

The command "ls &> e" entered at the shell (no python) behaves ok on
both machines.

Why?? How can I solve this?

Why?? I don't know. But you could try the commands module to work
around it...

open("e",'w').writelines(commands.getoutput('ls'))


HTH,

Emile
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,292
Messages
2,571,494
Members
48,179
Latest member
รับปั๊มไลค์|LikePro

Latest Threads

Top