Reputation: 174
I know it's possible to change the command not found message via .bashrc, but is it possible to use a similar method to change the default "No such file or directory" message? I looked in the bash source code for the solution, and it would seem the best option might be to edit support/mkclone
and then recompile bash, but for reasons I won't specify, doing that will be a pain in this scenario, so I'm hoping to avoid that if I can and simply go with a solution similar to the command not found solution.
EDIT: I'm specifically talking about through the cd command, but I'm hoping to change every possible way that bash can output this message.
Upvotes: 4
Views: 405
Reputation: 14452
Not a complete solution, but something worth trying:
Bash is using 'gettext' to translate all messages. Consider setting up a translate file (".po" and ".mo") which will 'translate' into English. For example:
msgid "No such file or directory"
msgstr "foo bar"
Compile to "mo", and deploy to /usr/share/locale/en/LC_MESSAGES
I never tried it, but in theory, this should work like translation to any other language.
Possible to make it a global change by apply similar logic to create "libc.mo".
Upvotes: 2