jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: system and shell redirect


Hello G.,

"G. Milde" <g.milde@xxxxxx> wrote:
> Dear Jed Users,
>
> the system() function calls a system command and returns the return status.
> Nice.
>
>   if (0 == system("which jed"))
>      message("jed installed");
>   
> The output of the system command goes "upstream", no problem in xjed, but
> jed in an xterm gets messed up. In jed <= 99.16 it was possible to use
>
>   system("which jed >& /dev/null");

What should this do? The >& operator do not accept a file:

 The redirection operator

       [n]>&word

 is used to duplicate one output file descriptor from another, or to close
 one.  If word evaluates to one or more digits, the file descriptor
 denoted by n, or standard output if n is not specified, shall be made to
 be a copy of the file descriptor denoted by word; if the digits in word
 do not represent a file descriptor already open for output, a redirection  1
 error shall result (see 3.8.1).  If word evaluates to -, file descriptor   1
 n, or standard output if n is not specified, shall be closed.  If word
 evaluates to something else, the behavior is unspecified.

> to do away with the output. Now (Jed Version: B0.99.17-111
> S-Lang Version: 2.0.4) the return value of this command with shell redirect
> is 512.
>
> Could someone tell me the reason for this change and maybe propose a
> workaround?

The reason should not be in jed. Try sh -c 'which jed >& /dev/null' at
the command line. At me, this gives an error. Maybe you want something
like 'which jed >/dev/null 2>&1'

Bye, Jörg.
-- 
Je planmäßiger ein Mensch vorgeht,
desto stärker mag ihn der Zufall treffen.
		    Erich Krunau "Die Physiker"

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]