Hi!
I'm trying to learn shell scripting and have runned into problems with functions.
Since you have to read all functions into memory before they are used it would be nice to be able to place all your functions in an functions.sh file and start the main script by running the function.sh script i.e. read all functions into memory.
Is this possible?
I have tried to place the functions in a script:
#!/bin/sh -vx
s_echo_hello()
{
echo hello
}
And then read it and tried to run the s_echo_hej in another script:
#!/bin/sh -vx
/tmp/common.sh
s_echo_hello
Here are the result:
#!/bin/sh -vx
/tmp/common.sh
+ /tmp/common.sh
#!/bin/sh -vx
s_echo_hej()
{
echo hej
}
s_echo_hej
+ s_echo_hej
./testi.sh: s_echo_hej: not found
Is this possible? And in that case, what am I doing wrong?
TIA
Niklas