Hello.
I have 79 small bash function in a script file for 115kb.
This file has been verified with ‘Shell Check’
This file is sourced in /etc/profile.local.
After sourcing, within /etc/profile.local I test the accessibility of 2 functions this way :
A_FLAG1=$(LC_ALL=C type -t function1)
A_FLAG2=$(LC_ALL=C type -t function2)
if -n "$A_FLAG1" && "$A_FLAG1" == "function" && -n "$A_FLAG2" && "$A_FLAG2" == "function" ]] ; thenlogger "common functions defined"
elselogger "common functions not defined" "emerg"
fi
and do not get errors.
In user’s .bashrc I test the functions accessibility the same way.
Openning a terminal from konsole application launcher I got an error.
I wrote a small script to make test using a for loop with A_FLAG=$(LC_ALL=C type -t some_function).
50% of the functions are not available for the user.
~> ~/check_export_system_common_function
FUNCTION Number : 1 ; DEFINED : FALSE !!! ;
FUNCTION Number : 3 ; DEFINED : FALSE !!! ;
FUNCTION Number : 4 ; DEFINED : FALSE !!! ;
FUNCTION Number : 5 ; DEFINED : FALSE !!! ;
FUNCTION Number : 7 ; DEFINED : FALSE !!! ;
FUNCTION Number : 10 ; DEFINED : FALSE !!! ;
FUNCTION Number : 11 ; DEFINED : FALSE !!! ;
FUNCTION Number : 12 ; DEFINED : FALSE !!! ;
FUNCTION Number : 13 ; DEFINED : FALSE !!! ;
FUNCTION Number : 15 ; DEFINED : FALSE !!! ;
FUNCTION Number : 17 ; DEFINED : FALSE !!! ;
FUNCTION Number : 20 ; DEFINED : FALSE !!! ;
FUNCTION Number : 22 ; DEFINED : FALSE !!! ;
FUNCTION Number : 24 ; DEFINED : FALSE !!! ;
FUNCTION Number : 28 ; DEFINED : FALSE !!! ;
FUNCTION Number : 31 ; DEFINED : FALSE !!! ;
FUNCTION Number : 33 ; DEFINED : FALSE !!! ;
FUNCTION Number : 34 ; DEFINED : FALSE !!! ;
FUNCTION Number : 35 ; DEFINED : FALSE !!! ;
FUNCTION Number : 40 ; DEFINED : FALSE !!! ;
FUNCTION Number : 43 ; DEFINED : FALSE !!! ;
FUNCTION Number : 46 ; DEFINED : FALSE !!! ;
FUNCTION Number : 48 ; DEFINED : FALSE !!! ;
FUNCTION Number : 52 ; DEFINED : FALSE !!! ;
FUNCTION Number : 53 ; DEFINED : FALSE !!! ;
FUNCTION Number : 54 ; DEFINED : FALSE !!! ;
FUNCTION Number : 58 ; DEFINED : FALSE !!! ;
FUNCTION Number : 60 ; DEFINED : FALSE !!! ;
FUNCTION Number : 61 ; DEFINED : FALSE !!! ;
FUNCTION Number : 64 ; DEFINED : FALSE !!! ;
FUNCTION Number : 67 ; DEFINED : FALSE !!! ;
FUNCTION Number : 68 ; DEFINED : FALSE !!! ;
FUNCTION Number : 71 ; DEFINED : FALSE !!! ;
FUNCTION Number : 72 ; DEFINED : FALSE !!! ;
FUNCTION Number : 75 ; DEFINED : FALSE !!! ;
FUNCTION Number : 76 ; DEFINED : FALSE !!! ;
NUMBER of FUNCTION : 79
NUMBER of ERROR : 37
of course if I source manually the script in the current terminal session all the functions are available.
Changing the order of the functions in the script, change the numbers of errors :
Here another example with another order :
FUNCTION Number : 53 ; DEFINED : FALSE !!! ;
NUMBER of FUNCTION : 79
NUMBER of ERROR : 1
Any comment is welcome.