I mean I want to use unset that is not a shell function itself. If I could do that, I could make sure that command is pure by running
#!/bin/sh
{ \unset -f unalias command [; \unalias unset command [ } 2>/dev/null;
# make zsh find *builtins* with `command` too:
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on
If I am using Debian Almquist shell (dash), I think I can rely that \unset is pure. At least I could not define a shell function named unset in dash. Whereas in bash or in zsh I could define unset() { echo fake unset; }, and thereafter I am unable to unset the function: \unset -f unset outputs "fake unset".
Relating to this, in a bash script, one can export a function by export -f <function name> so that it can be used in bash scripts called by the script. However, the same does not work in dash scripts. I wonder, if I have to worry about a command being defined as a shell function outside a script file I am writing, if I am using dash? How about other POSIX compatible shells?