#!/usr/bin/bash
#
# Following 2 tests should both pass.
# Instead, 1st test fails in newer version of bash, but not on older version.

shopt -s igncr

pwd

# Result: /c/tmp

mount

# Result:
# c:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system (binmode)
# C:\cygwin\bin on /usr/bin type system (textmode)
# C:\cygwin\lib on /usr/lib type system (textmode)
# C:\cygwin on / type system (textmode)
# c: on /c type system (textmode)
# d: on /d type system (textmode)
# j: on /j type system (textmode)
# k: on /k type system (textmode)
# t: on /t type system (textmode)
# y: on /y type user (textmode)
# z: on /z type user (textmode)


################################################################################
# Test 1
# Passes in bash 3.1.17(6)-release
# Fails  in bash 3.1.17(9)-release

echo bar.txt > bar.txt

od -c bar.txt

# Result:
# 0000000   b   a   r   .   t   x   t  \r  \n
# 0000011

notepad `cat bar.txt`

# Open fails because `cat` output returns CR?

################################################################################
# Test 2
# Passes in bash 3.1.17(6)-release
# Passes in bash 3.1.17(9)-release

dos2unix -U bar.txt

od -c bar.txt

# Result:
# 0000000   b   a   r   .   t   x   t  \n
# 0000010

notepad `cat bar.txt`

