Obtaining the delta for 'declare -F' between current and clean shell environments
1
vote
1
answer
39
views
Main question: how would one get the delta for
declare -F
, between that in the current shell, and that as if the shell just started (first two commands below). $(declare -F)
does not solve the problem because the subshell is a copy of the shell process . Subsidiary: why does the third command below output nothing?
$ exec env -i bash
$ declare -F
declare -f ShowInstallerIsoInfo
declare -f __expand_tilde_by_ref
declare -f __get_cword_at_cursor_by_ref
declare -f __load_completion
declare -f __ltrim_colon_completions
declare -f __parse_options
declare -f __reassemble_comp_words_by_ref
declare -f _allowed_groups
declare -f _allowed_users
declare -f _available_interfaces
declare -f _bashcomp_try_faketty
declare -f _bq_completer
declare -f _cd
declare -f _cd_devices
declare -f _command
declare -f _command_offset
declare -f _complete_as_root
declare -f _completer
declare -f _completion_loader
declare -f _configured_interfaces
declare -f _count_args
declare -f _dvd_devices
declare -f _expand
declare -f _filedir
declare -f _filedir_xspec
declare -f _fstypes
declare -f _get_comp_words_by_ref
declare -f _get_cword
declare -f _get_first_arg
declare -f _get_pword
declare -f _gids
declare -f _have
declare -f _included_ssh_config_files
declare -f _init_completion
declare -f _installed_modules
declare -f _ip_addresses
declare -f _kernel_versions
declare -f _known_hosts
declare -f _known_hosts_real
declare -f _longopt
declare -f _mac_addresses
declare -f _minimal
declare -f _modules
declare -f _ncpus
declare -f _open_files_for_editing
declare -f _parse_help
declare -f _parse_usage
declare -f _pci_ids
declare -f _pgids
declare -f _pids
declare -f _pnames
declare -f _python_argcomplete
declare -f _quote_readline_by_ref
declare -f _realcommand
declare -f _rl_enabled
declare -f _root_command
declare -f _service
declare -f _services
declare -f _shells
declare -f _signals
declare -f _split_longopt
declare -f _sysvdirs
declare -f _terms
declare -f _tilde
declare -f _uids
declare -f _upvar
declare -f _upvars
declare -f _usb_ids
declare -f _user_at_host
declare -f _usergroup
declare -f _userland
declare -f _variables
declare -f _xfunc
declare -f _xinetd_services
declare -f dequote
declare -f quote
declare -f quote_readline
$ "$SHELL" -c 'declare -F'
Other:
$ uname -a
Linux elitebook 6.7.3-arch1-2 #1 SMP PREEMPT_DYNAMIC Fri, 02 Feb 2024 17:03:55 +0000 x86_64 GNU/Linux
$ bash --version
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)
$ echo $SHELL
/bin/bash
## Update:
> The clean state is an empty list of functions, as seen in the output of bash -c 'declare -F'
Based on the first command I expected the second to output two functions rather than zero.
$ grep -F -f I expected the second to output two functions rather than zero.
Here might be the reason for sourcing not taking effect:
$ cat ~/.bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
Workaround does output two functions.
$ bash -c 'source /dev/null
Asked by Erwann
(729 rep)
Mar 13, 2024, 06:10 AM
Last activity: Mar 13, 2024, 03:51 PM
Last activity: Mar 13, 2024, 03:51 PM