Suppressing error msgs from cmd-line.

Discussion in 'Java' started by Lax, Feb 27, 2004.

  1. Lax

    Lax Guest

    Hello all,
    From my Java program, I'm constructing a cmd-line one-liner and
    running it from the shell on various platforms.

    Is there any platform independent way to suppress error messages from
    the cmd-line?
    e.g., if the program does a "ls somefile.txt" on Unix and an analogous
    "dir somefile.txt" on WIN, I want to suppress the error msgs, if
    somefile.txt is not present.

    In Unix, I could do a "ls somefile.txt 2> /dev/null".
    But, is there a platform independent way to do the suppression.

    Alternatively, how does one suppress the error msgs from WIN cmd? :)

    Thanks for your time,
    Prab
     
    Lax, Feb 27, 2004
    #1
    1. Advertising

  2. Lax

    Johan Poppe Guest

    Lax skrev:

    >e.g., if the program does a "ls somefile.txt" on Unix and an analogous
    >"dir somefile.txt" on WIN, I want to suppress the error msgs, if
    >somefile.txt is not present.
    >
    >In Unix, I could do a "ls somefile.txt 2> /dev/null".
    >But, is there a platform independent way to do the suppression.


    Yes: Write a Java program :)

    >Alternatively, how does one suppress the error msgs from WIN cmd? :)


    dir somefile.txt 2> nul

    (I'm not quite sure if error redirection works on win95)

    --
    Riktig sitering gjør meldingene dine lettere å lese:
    < url: http://home.online.no/~vidaandr/news/OBSquoting.html >
     
    Johan Poppe, Feb 27, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Achim Domma (Procoders)

    read input for cmd.Cmd from file

    Achim Domma (Procoders), Jun 3, 2005, in forum: Python
    Replies:
    2
    Views:
    8,075
    Peter Otten
    Jun 3, 2005
  2. Sarir Khamsi

    Interpreter-like help in cmd.Cmd

    Sarir Khamsi, Jun 9, 2005, in forum: Python
    Replies:
    4
    Views:
    379
    Bengt Richter
    Jun 26, 2005
  3. =?ISO-8859-1?Q?Sch=FCle_Daniel?=

    [exec cmd for cmd in cmds]

    =?ISO-8859-1?Q?Sch=FCle_Daniel?=, Mar 8, 2006, in forum: Python
    Replies:
    3
    Views:
    389
    Scott David Daniels
    Mar 8, 2006
  4. Diez B. Roggisch

    pydb remote debugging/cmd.Cmd over socket?

    Diez B. Roggisch, May 28, 2008, in forum: Python
    Replies:
    2
    Views:
    551
    Diez B. Roggisch
    May 29, 2008
  5. Victor Reyes
    Replies:
    7
    Views:
    131
    Victor Reyes
    Dec 27, 2007
Loading...

Share This Page