Add an accurate error message for "sudo cd"

Andrea Monaco <[email protected]> Mon, 11 Oct 2021 16:18:14 +0200
Newsgroups gmane.comp.tools.sudo.devel
Message-ID <[email protected]>
Hello,


as we all know, the command "sudo cd" usually doesn't work, because cd
is often implemented as a shell builtin.

This is pretty obvious to an experienced user, but I remember being
quite puzzled as a beginner, before searching the web for an
explanation. I think that this happens to many people.

Therefore I propose adding an explicit message, whenever there's (1) a
command not found and (2) the first token is "cd".

Something like this:

  $ sudo cd /root
  sudo: cd: command not found
  sudo: "cd" is often implemented as a shell builtin and thus not
  available to sudo. Maybe you want to switch to a root shell with "sudo -s"?



Let me know,

Andrea Monaco


____________________________________________________________
sudo-workers mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-workers