A bash builtin command named “enable” to enable or disable a bash builtin command

[bash light=”true”]
$command
$echo $?
0
$enable -n command
$command
bash: command: command not found
$echo $?
127
$enable command
$command
$enable -n enable
$enable
bash: enable: command not found
$
[/bash]
RELATED SOURCE CODE EXPOSURE
[c light=”true”]
/* Enable/disable shell commands present in LIST. If list is not specified,
then print out a list of shell commands showing which are enabled and
which are disabled. */
int
enable_builtin (list)
WORD_LIST *list;
{
int result, flags;
int opt, filter;
#if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
char *filename;
#endif

result = EXECUTION_SUCCESS;
flags = 0;

reset_internal_getopt ();
while ((opt = internal_getopt (list, "adnpsf:")) != -1)
{
switch (opt)
{
case ‘a’:
flags |= AFLAG;
break;
case ‘n’:
flags |= NFLAG;
break;
case ‘p’:
flags |= PFLAG;
break;
case ‘s’:
flags |= SFLAG;
break;
case ‘f’:
#if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
flags |= FFLAG;
filename = list_optarg;
break;
#else
builtin_error (_("dynamic loading not available"));
return (EX_USAGE);
#endif
#if defined (HAVE_DLCLOSE)
case ‘d’:
flags |= DFLAG;
break;
#else
builtin_error (_("dynamic loading not available"));
return (EX_USAGE);
#endif /* HAVE_DLCLOSE */
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
}
}

list = loptend;

#if defined (RESTRICTED_SHELL)
/* Restricted shells cannot load new builtins. */
if (restricted && (flags & (FFLAG|DFLAG)))
{
sh_restricted ((char *)NULL);
return (EXECUTION_FAILURE);
}
#endif

if (list == 0 || (flags & PFLAG))
{
filter = (flags & AFLAG) ? (ENABLED | DISABLED)
: (flags & NFLAG) ? DISABLED : ENABLED;

if (flags & SFLAG)
filter |= SPECIAL;

list_some_builtins (filter);
}
#if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
else if (flags & FFLAG)
{
filter = (flags & NFLAG) ? DISABLED : ENABLED;
if (flags & SFLAG)
filter |= SPECIAL;

result = dyn_load_builtin (list, filter, filename);
#if defined (PROGRAMMABLE_COMPLETION)
set_itemlist_dirty (&it_builtins);
#endif
}
#endif
#if defined (HAVE_DLCLOSE)
else if (flags & DFLAG)
{
while (list)
{
opt = dyn_unload_builtin (list->word->word);
if (opt == EXECUTION_FAILURE)
result = EXECUTION_FAILURE;
list = list->next;
}
#if defined (PROGRAMMABLE_COMPLETION)
set_itemlist_dirty (&it_builtins);
#endif
}
#endif
else
{
while (list)
{
opt = enable_shell_command (list->word->word, flags & NFLAG);

if (opt == EXECUTION_FAILURE)
{
sh_notbuiltin (list->word->word);
result = EXECUTION_FAILURE;
}
list = list->next;
}
}
return (result);
}
[/c]
SOURCE CODE TAKEN FROM DEBIAN Bash SOURCE