Problems with one of my scripts appear to have been caused by dash's read -r
translating escape sequences (like \t) whereas several other shells read them
literally. For example:
$ printf '%s' '\a\t\x' > backslashes
$ dash -c 'read -r foo < backslashes; echo "$foo"' | cat -t
^G^I\x
$ bash -c 'read -r foo < backslashes; echo "$foo"' | cat -t
\a\t\x
$ ksh -c 'read -r foo < backslashes; echo "$foo"' | cat -t
\a\t\x
POSIX says of -r, "Do not treat a <backslash> character in any special way.
Consider each <backslash> to be part of the input line" [1]. Translating them
as escape sequences doesn't appear to be particularly compatible with this, but
conceivably the translation is occurring at some other stage.
Is this the intended behaviour?
Thanks,
John
[1]
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html#tag_20_109_04
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html