The bash script is sourced from /etc/profile.local.
When I test if all functions has been exported I found that 12 were missing ( those whose name are at the beginning of a line) :
~> env | grep BASH_ | sort
BASH_FUNC_array_contains_element%%=() { local e;
BASH_FUNC_ask_YyRr%%=() { local L_REPLY="" L_PARAM1=" ";
BASH_FUNC_ask_Yy_Y%%=() { local L_REPLY="" L_PARAM1=" ";
BASH_FUNC_ask_YyYy%%=() { local L_REPLY="" L_PARAM1=" ";
BASH_FUNC_confirm_twice%%=() { local L_CUR_DATE;
BASH_FUNC_copy_link_to_dest%%=() { local L_NUM_ARG=0;
BASH_FUNC_create_encrypted_password%%=() { local -i L_LEN_SALT=0 L_OFFSET=0 L_FLAG=1;
BASH_FUNC_create_my_directory_user%%=() { local l_user_home_flag="$1";
BASH_FUNC_create_user%%=() { declare -i L_ERREUR_CODE=0;
BASH_FUNC_date2stamp_2%%=() { date --date "$1" +%Y_%m_%d
BASH_FUNC_date2stamp2%%=() { date --date "$1" +%Y_%m_%d__%Hh%M
BASH_FUNC_date2stamp%%=() { date --date "$1" +%Y-%m-%d
BASH_FUNC_date2stamp_full%%=() { date --date "$1" +%Y-%m-%d__%H-%M-%S
date2stamp_full2
BASH_FUNC_deactivate_all_repo%%=() { local -a L_ARRAY_LIST_CURRENT_REPO;
BASH_FUNC_debug_stop_or_continue%%=() { local L_REPLY="" L_PARAM1=" " L_CAT_FILE1=" " L_CAT_FILE2=" ";
download_http_link
BASH_FUNC_flag_debug_msg%%=() { local L_REPLY="" L_FLAG=" ";
BASH_FUNC_get_config_param_string%%=() { local FILE_NAME=" ";
BASH_FUNC_get_config_param_val%%=() { delare -i L_DEBUG;
BASH_FUNC_get_config_param_val_in_section%%=() { local -i L_DEBUG L_RETURN_CODE=0;
BASH_FUNC_get_last_word_from_string%%=() { local LOCAL_STRING="";
BASH_FUNC_get_my_error_name%%=() { local __resultvar=$1;
get_operator_input
get_operator_input2
get_string_length
BASH_FUNC_http_link_exists%%=() { local L_ERR_CODE=0;
BASH_FUNC_install_new_app_one_by_one%%=() { local -a L_ARRAY;
BASH_FUNC_main_repositories_exists%%=() { local -a L_ARRAY_MAIN_REPOS;
make_bash_local
BASH_FUNC_make_main_directory_backup%%=() { local L_CUR_DATE;
BASH_FUNC_message_begin_script%%=() { local -a L_ARRAY;
BASH_FUNC_message_debug%%=() { local -a L_ARRAY;
BASH_FUNC_message_end_script%%=() { local -a L_ARRAY;
BASH_FUNC_message_error%%=() { local -a L_ARRAY;
BASH_FUNC_message_header%%=() { local -a L_ARRAY;
message_informal
BASH_FUNC_message_success%%=() { local -a L_ARRAY;
BASH_FUNC_move_downloaded_file%%=() { local L_SRC_FILE=" ";
BASH_FUNC_my_get_salt%%=() { date --date "$1" +%s%N
BASH_FUNC_print_array_full%%=() { local -i L_NB_ELEMENT;
BASH_FUNC_print_array_if_debug_on%%=() { local -i L_DEBUG=0;
BASH_FUNC_print_if_debug_on%%=() { local -i L_DEBUG;
print_var
print_var_to_file
return_new_version_file
BASH_FUNC_search_after_token%%=() { local CMD=" ";
BASH_FUNC_stop_or_continue%%=() { local L_REPLY="" L_PARAM1=" ";
BASH_FUNC_trim_quote_in_string%%=() { sed 's/^"*//;s/"*$//'
BASH_FUNC_trim_string%%=() { sed 's/^ *//;s/ *$//'
yes_or_not
yes_or_not_confirm
For testing I added another bash script with the missing functions.
Then I added one more source command in /etc/profile.local to source the new script.
Only one more function were exported from /etc/profile.
If I open a terminal (konsole) and then source either the full functions script or the complementary functions script, the missing functions are exported.
the file ~/.profile is read during the log in process.
In this file, I test if one missing function exits using :
tf=$(type -t print_var_to_file 2>/dev/null || rt=$?)
if "$tf" == "function" ]]; then
MY_LOGGER "~/.profile - FUNCTION : 'print_var_to_file' is exported"
else
MY_LOGGER "~/.profile must source /backup_sys/000_COMMON/Bin/system_common_function"
fi
Reading systemd journal I can read :
mai 28 18:24:40 LINUX JCD_HOME_USER_PROFILE[2432]: hBc - ~/.profile - FUNCTION : 'print_var_to_file' is exported - USER : superjc
But after log in is finished if I open a terminal the missing functions still have disappear.
If you’re referring to the actual “source” command,
You shouldn’t be inserting that into a profile.local, the “source” command is only used to activate changes in profile (including profile.local) without having to reboot.
If you’re inserting something very large and might run into buffer issues, an alternative to inserting in a profile.local is to place the individual scriptlets (instead of one big script) in different files in /etc/profile.d/. So, for instance a big clue to whether you’re encountering some kind of buffer problem is if your missing commands are all at the end of what you are trying to append.
https://github.com/scop/bash-completion
Install bash-completion
Writes to the /etc/profile.d/ directory. Although normally not much different than writing to a profile.local, this method instead encourages the use of smaller scripts, each script in its own text file. Perhaps better organization since all the individual scripts can be placed in this one directory.