Is it possible to customize the Bash error messages attributes?
For example, is it possible to edit the
.bash_profile to get the following Bash error message
-bash: cd: foo: No such file or directory
migrated from stackoverflow.com Jan 26 '13 at 13:26
This question came from our site for professional and enthusiast programmers.
Sadly, there is no
stderred is a comprehensive solution for this type of problem, but it will not work without modification as it has a hard-coded exclude for
hilite requires you to use it as a wrapper, this won't work for bash builtin commands like
Your question asks specifically about bash error messages, these are send to
A hidden issue here is that
Builtins call (or at least should call) the
Without jumping through hoops, or patching
This uses the bash
I use a variation on this in my
(Also, since it's referenced, the
Below solution works for what you want:
Basically, above command prints stderr in red.
Check below screen shot:
I do not know how to make this permanent. However, this should definitely give you some pointers.
Put this into your
It will make
Here is a new and improved version of the above:
Taken from bash's manpage
So if this does not work, maybe your shell is not true