Maybe BASH should instead output "$'\r'" in the error message in your case.
-- Sent from my iPad > On Sep 10, 2014, at 1:58 AM, Vincent Lefevre <vinc...@vinc17.net> wrote: > > In error messages, raw non-printable characters from arguments should > not be output without transformation, at least if this is on a terminal. > If stderr has been redirected, this is more a matter of choice. > > An example: type "cd /^M" where ^M is a CR character (e.g. obtained by > typing ^V ^M). One gets on the terminal: > > : No such file or directory > > which is not very informative. This leads to this kind of questions: > > > http://unix.stackexchange.com/questions/154408/cant-cd-to-home-user-when-sourcing-a-script > > IMHO, in this case, bash should do like zsh, which replaces the CR > character by the character sequence "^M". > > -- > Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> > 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> > Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) >