From: "Richard A. Ryan" Date: 2002-08-17T07:57:45+09:00 Subject: How do I dup file descriptors in ruby? (diverting STDERR) Hello, How would I do the equivalent to the following Korn/Bourne code in ruby? ###################################### # Save STDERR default exec 3>&2 # Send STDERR to a file exec 2> logfile.text # Do stuff that might have error messages in it # Error will go to logfile.text instead of the # terminal. /bin/ls non_existent_file echo "hello world" 1>&2 run_non_existent_command # Restore STDERR exec 2>&3 # Close extra file descriptor exec 3>&- # Error messages will now go to the terminal ###################################### Thank you for any help you can give, Richard Ryan