Why echo- does carriage return from an OSX terminal behave differently than from a bashscript?
From the terminal in OSX 10.7.3:
$ echo $SHELL
/bin/bash
$ /bin/bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Copyright (C) 2007 Free Software Foundation, Inc.
$ echo -ne "hello\rbye"
byelo
But I see a different result from test.sh:
#!/bin/bash
echo -ne "hello\rbye"
... running test.shgives me:
$ ./test.sh
byehello
I was expecting byelo. Why is it different? and how to fix it?
source
share