system(), shell, & stderr.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

system(), shell, & stderr.

niles-3

I want to issue a system command in octave and re-direct stderr.

Problem: Different shells have different syntax for stderr redirection.
e.g. (ba)sh --> 'ls 2> /dev/null'
     (t)csh --> 'ls >& /dev/null'

I have no control over which shell "system(cmd)" executes cmd in.
It is whatever login shell the user has.

Perhaps, an optional argument could be added to "system" to set
the shell, or some global variable. (SHELL)

Also, perhaps system should have a mech. for trapping stderr,
like it already does for stdout.

Without, reducing to a two-line shell script I can't see a way
to redirect stderr shell-independently.

If there's a way to redirect stderr with the current octave, please
someone enlighten me. :)

        Thanks,
        Rick Niles.