I just noticed that I've seen different behavior across different systems when creating a quick test file (e.g. with sample input) via
cat and redirection.
Here are the steps to see what I'm talking about:
cat > testfile.
helli, then press backspace, then type
Type Ctrl-D to end the input.
od -a testfile.
On some systems, e.g. Mac, you will get:
0000000 h e l l o nl 0000006
On other systems, e.g. a RHEL 5.7 host that I logged into via MobaXterm on Windows, you may get:
0000000 h e l l i bs o nl 0000010
Where is the code that makes for this difference? For example, in the example above, should I suspect MobaXterm, or the RHEL 5 system? Or which layer between my keyboard and the filesystem?
This is more a question out of curiosity than a real problem; I can obviously create files without the backspace characters by just using a text editor, but this has tripped me up in the past. One time during a casual presentation/training, I mentioned that creating files via
cat has this problem with backspace characters being taken literally, only to be shown wrong when it didn't have that effect after all, on the Macs the students were using. So it got me curious.