In article < >,
(jonathan) wrote:
> which works for the simple case, but how about:
>
> system( "ls -lR > 1 2>&1" );
The problem there is that that's not a command followed by its
arguments; its a command, an argument and then _shell metacharacters_.
So you need a shellto execute - and with the multi-arg forms of system()
you're specifically not getting a shell, which means that thome
metacharacters aren't doing much.
Now, off the top of my head, how about
:
system { 'sh' } 'secretls', '-c', 'ls -lR > 1 2>&1';
Because there you're executing sh(1) and giving it a string to parse...
Hang on I've just tried that and ps -Afw says:
pkent 12207 12206 1 23:18 pts/5 00:00:00 secretls -c ls -lR > 1
2>&1
which of course shows the args.
Actually, one thing you can do is open the relevant filehandles in perl
and do an exec() - no need to involve the shell at all! No need to use
redirection symbols! I think that the spawned ls(1) process would show
up but then it's a process, so it _has_ to show up.
Alternatively you can implement ls -lR in perl and then you have no need
of a subprocess at all! Already done, in fact, to some extent at
http://www.perl.com/language/ppt/src/ls/index.html
So there you go - do it all within perl
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply