i guess one can alias for the root user too but its annoying.
i guess one can alias for the root user too but its annoying.
alias sudo='sudo '
If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion.IIUC the reason sudo ignores the path is because if you use per-command sudo rules you often depend on the path being correct.
[1] Section 6.6 in https://www.gnu.org/software/bash/manual/html_node/Aliases.h...
And the above is also why the shell metacharacters (such as dollar, asterisk, square brackets) that you may use in any Unix command invocation, get expanded by the shell, not by any individual command[2], which is why these metacharacters work for any command, old or new, built-in, external or user-written (in any language, as long as it supports argc/argv-like conventions), . This is unlike MS-DOS, for example, where some commands supported wildcards but others did not. There, the support was programmed into (only some of) the individual commands. (CMD.EXE of later Windows versions may be different, and IIRC, is more Unix-like.)
[2] That may be a less-known fact.
sort of like a space before a command and it doesn't go into bash's history (if enabled)
#!/bin/sh
# call this file 'smv' or whatever
exec mv --no-clobber "$@"
You only have to pay the 'annoying' cost once to add /some/util/script/dir/ to both the user's and root's $PATH.Put it in /.../sbin. It’ll be accessible to both root and non-root users.