Can we pass some arguments to system(cmdline)?

2005-06-20 Thread Didier C
Hi! I was wondering if we can pass some arguments to system(cmdline)? E.g in Perl, we can do something like: $dir=/home/cypher; system(ls $dir); which would instruct Perl to do an ls /home/cypher But in python, doing something like dir=/home/cypher system(ls dir) would cause python

Re: Can we pass some arguments to system(cmdline)?

2005-06-20 Thread Qiangning Hong
Didier C wrote: Hi! I was wondering if we can pass some arguments to system(cmdline)? E.g in Perl, we can do something like: $dir=/home/cypher; system(ls $dir); which would instruct Perl to do an ls /home/cypher But in python, doing something like dir=/home/cypher system(ls

Re: Can we pass some arguments to system(cmdline)?

2005-06-20 Thread Andreas Kostyrka
On Sun, Jun 19, 2005 at 11:12:05PM -0700, Didier C wrote: Hi! I was wondering if we can pass some arguments to system(cmdline)? E.g in Perl, we can do something like: $dir=/home/cypher; system(ls $dir); which would instruct Perl to do an ls /home/cypher But in python, doing

Re: Can we pass some arguments to system(cmdline)?

2005-06-20 Thread Leif K-Brooks
Didier C wrote: E.g in Perl, we can do something like: $dir=/home/cypher; system(ls $dir); Is there a way to reproduce the same thing in Python? system(ls %s % dir) But you should really be using subprocess for security (so that if dir==/home/foo; rm -rf / nothing bad will happen):

Re: Can we pass some arguments to system(cmdline)?

2005-06-20 Thread Didier Casse
Thanks all for the reply. I'll try out those things out. :) Cheers, Didier. Leif K-Brooks a écrit : Didier C wrote: E.g in Perl, we can do something like: $dir=/home/cypher; system(ls $dir); Is there a way to reproduce the same thing in Python? system(ls %s % dir) But you

Re: Can we pass some arguments to system(cmdline)?

2005-06-20 Thread Piet van Oostrum
Didier Casse [EMAIL PROTECTED] (DC) wrote: DC Thanks all for the reply. I'll try out those things out. :) But don't try the following system(ls $dir); with dir==/home/foo; rm -rf / -- Piet van Oostrum [EMAIL PROTECTED] URL: http://www.cs.uu.nl/~piet [PGP] Private email: [EMAIL PROTECTED]