I have created a file with a number of bash functions defined. When I "source" it from another bash script that I execute while logged on, everythinng runs as expected. However, if I attempt to source it in a script that is linked as part of my startup (say from /etc/rc2.d/S99test) the attempt to source fails.
For example, if my functions file, "test_functions", contains:
And I source in an init script, "/etc/init.d/test_init.sh":
function test ()
echo "Test function output..." >> /tmp/test.out
If I execute the script while logged in everything is fine. But when the system is rebooted, the attempt to source fails. The error that I managed to trap is as follows:
### BEGIN INIT INFO
# Required-Start: $remote_fs $syslog $all
# Default-Start: 2 3 4 5
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
I also noticed that when I am logaged on I can use the command "source" in the script but during reboot a "command not found error" occurs leading me to believe that there is some inherit difference in the execution environment.
/usr/local/repo/test: 3: Syntax error: "(" unexpected
How can I workaround this issue?