SML108@psuvm.psu.edu (Scott the Great) (09/03/90)
Hi, I am using system(command) to call ls and get a file listing which I re-direct to a file. This works rather well, but if no match is found, an error is reported to the calling shell. Is there any way to suppress this error reporting? Scott Le Grand aka sml108@psuvm.psu.edu
jak@sactoh0.SAC.CA.US (Jay A. Konigsberg) (09/04/90)
In article <90245.224246SML108@psuvm.psu.edu> SML108@psuvm.psu.edu (Scott the Great) writes: >Hi, I am using system(command) to call ls and get a file listing which >I re-direct to a file. This works rather well, but if no match is found, >an error is reported to the calling shell. Is there any way to suppress >this error reporting? Yes. Though I don't know how your getting this to a file, I'll assume your either using the '>' shell operator rather than the dup(2) system call. system("ls 1>/tmp/file 2>/dev/null"); this redirects stdout to the file and stderr to the system trash can. However, depending on exactly what your doing, you may want to look into using dup(2). I'm not completly sure how it would work, but then I just figured out why dup(2) is useful. -- ------------------------------------------------------------- Jay @ SAC-UNIX, Sacramento, Ca. UUCP=...pacbell!sactoh0!jak If something is worth doing, its worth doing correctly.