Kevin Layer wrote: > I'm really perplexed by the following behavior: > > [EMAIL PROTECTED] ~ > $ cat -v foo1.sh > echo 8010 > foo1.out > > [EMAIL PROTECTED] ~ > $ cat -v foo2.sh > sh foo1.sh > version=`cat foo1.out` > echo ${version}.bar > foo2.out > cat -v foo2.out > > [EMAIL PROTECTED] ~ > $ sh foo2.sh > 8010^M.bar^M > > [EMAIL PROTECTED] ~ > $ mount > 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) > z: on /z type system (textmode) > > [EMAIL PROTECTED] ~ > $ > > > The (real) scripts involved run on non-Windows platforms, so putting > in `d2u' isn't an option. I'd rather not resort to `tr' either, since > I have a large number of places to fix. Large. > > The bug, IMO, is the assigment to version of `cat foo1.out` contains a > ^M. I'm on a text mount, so this is counter to what I thought would > happen.
I don't know if this helps you or not, but I get slightly different output, consistent with what I believe you expected. igncr will indeed eat the \r from the `cat...` (thanks Eric once again). Unfortunately you're still left with the trailing \r from the last cat. [EMAIL PROTECTED]:~% sh foo2.sh 8010.bar^M [EMAIL PROTECTED]:~% sh --version GNU bash, version 3.2.5(7)-release (i686-pc-cygwin) Copyright (C) 2005 Free Software Foundation, Inc. [EMAIL PROTECTED]:~% echo $SHELLOPTS braceexpand:emacs:hashall:histexpand:history:igncr:interactive-comments: monitor But as was recently pointed out on the list, echo -n would suppress the final \r in your test case. Dan -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/