From: pjfarley AT dorsai DOT org (Peter J. Farley III) Newsgroups: comp.os.msdos.djgpp Subject: /dev/null BASH bug? Date: Mon, 02 Jun 1997 21:00:43 GMT Organization: The Dorsai Embassy, Inc. Lines: 70 Message-ID: <33932f7d.19066230@news.dorsai.org> NNTP-Posting-Host: pjfarley.ppp1.dorsai.org To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I think I have found a bug (difference?) in the way DJGPP libc treats /dev/null under COMMAND.COM and the way it treats it under BASH (Version 1.14.7, EXE dated 4/19/97, 10:03PM). Program versions I am running are as follows: bash.exe$ grep -V GNU grep version 2.0 usage: grep [-[[AB] ]] [-[CEFGVchilnqsvwxUu]] [-[ef]] [] bash.exe$ bash -version GNU bash, version 1.14.7(1) r3 w/multibyte extension bash.exe$ Here is a set of pairs of grep commands that should work; all but the last pair fail to work as I expect under bash. In each pair of grep commands, I would expect the first to return a status of "1" (the string does *not* exist in the file), and the second to return a status of "0" (the string *does* exist in the file). Instead, the various encodings of "/dev/null" cause failure even when I would expect success. Following the listing of the file "tdevnull" is the results of running it under bash. -------- file tdevnull ----------- #! /bin/sh echo "grimblepritz" >grimble grep blurfldyick grimble >/dev/null 2>&1 echo "1st grep returned $?" grep grimblepritz grimble >/dev/null 2>&1 echo "2nd grep returned $?" grep blurfldyick grimble >/dev/null 2>/dev/null echo "3rd grep returned $?" grep grimblepritz grimble >/dev/null 2>/dev/null echo "4th grep returned $?" grep blurfldyick grimble &>/dev/null echo "5th grep returned $?" grep grimblepritz grimble &>/dev/null echo "6th grep returned $?" grep blurfldyick grimble &>nul echo "7th grep returned $?" grep grimblepritz grimble &>nul echo "8th grep returned $?" rm -f grimble ---------- execute file tdevnull under bash ------------ bash.exe$ ./tdevnull ./tdevnull: /dev/null: No such file or directory (ENOENT) 1st grep returned 1 ./tdevnull: /dev/null: No such file or directory (ENOENT) 2nd grep returned 1 ./tdevnull: /dev/null: No such file or directory (ENOENT) 3rd grep returned 1 ./tdevnull: /dev/null: No such file or directory (ENOENT) 4th grep returned 1 ./tdevnull: /dev/null: No such file or directory (ENOENT) 5th grep returned 1 ./tdevnull: /dev/null: No such file or directory (ENOENT) 6th grep returned 1 7th grep returned 1 8th grep returned 0 bash.exe$ --------------- end of execution -------------------- Am I missing something here, or is this a real bug? TIA for any help or info you can provide. ---------------------------------------------------- Peter J. Farley III (pjfarley AT dorsai DOT org)