--- Silvan Villiger <[EMAIL PROTECTED]> wrote: > I've started to learn scripting in linux. But I have some troubles > understandig the redirection of the streams. I tried to test whether a > directory already exists using the ls command (didn't find a bether > solution) and whenever ls doesn't find such a directory it writes an
[ -d /some/directory ] && echo "directory exists" >&2 || echo "nope. does not exist" >&2 Which will echo the reply to stderr. > Another example I had, was when I tried to compile a latex-file in a > script. How can i prevent it from writing compiling-informations to the > shell which started the script? thescript 2> /dev/null would redirect all errors to the bit-bucket. If you wanted to blank the entire lot: thescript > /dev/null 2>&1 (or, if you don't care for portability, the command above is the same as: thescript &> /dev/null ) HTH, -- Thomas Adam ===== "The Linux Weekend Mechanic" -- http://linuxgazette.net "TAG Editor" -- http://linuxgazette.net "<shrug> We'll just save up your sins, Thomas, and punish you for all of them at once when you get better. The experience will probably kill you. :)" -- Benjamin A. Okopnik (Linux Gazette Technical Editor) ___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]