home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / bash / bug / 711 < prev    next >
Encoding:
Text File  |  1992-12-26  |  1.1 KB  |  50 lines

  1. Newsgroups: gnu.bash.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!junio
  3. From: junio@twinsun.COM (Jun Hamano)
  4. Subject: 'case' broken?
  5. Message-ID: <bk6K|#cx@twinsun.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: Twin Sun, Inc. (El Segundo CA)
  8. Distribution: gnu
  9. Date: Sat, 26 Dec 1992 04:40:15 GMT
  10. Approved: bug-bash@prep.ai.mit.edu
  11. Lines: 37
  12.  
  13. I found a small incompatibility between bash 1.12 and /bin/sh
  14. SunOS 4.1.2.  I'm not sure if this is a bug, or `implementation
  15. defined' incompatibility.
  16.  
  17. The following code shows that bash's `case' thinks a string
  18. `abcd' matches *<newline>* while /bin/sh does not.
  19.  
  20. -- >8 -- 
  21. shadow 100) bash -c 'echo $BASH_VERSION'
  22. 1.12.1
  23. shadow 101) cat case.sh
  24. NL='
  25. '
  26.  
  27. for i in "$@"
  28. do
  29.     case $i in
  30.     *$NL*) echo "case: $i: newline detected"
  31.     esac
  32. done
  33. shadow 102) /bin/sh case.sh abcd 'ab
  34. > cd'
  35. case: ab
  36. cd: newline detected
  37. shadow 103) bash case.sh abcd 'ab
  38. > cd'
  39. case: abcd: newline detected
  40. case: ab
  41. cd: newline detected
  42. shadow 104) 
  43. -- >8 -- 
  44. --
  45.       |
  46.    __-+-__      Jun Hamano
  47. _-+ (|o|) +-_   junio@twinsun.com
  48.   !   .   !
  49.  
  50.