Can a bash function be used in different scripts?
bash, function
Solution
Sure - in your script, where you want to use the function, you can write a command like
source function.sh
which is equivalent to including the contents of `function.sh` in the file at the point where the command is run. Note that `function.sh` needs to be in one of the directories in `$PATH`; if it's not, you need to specify an absolute path.
Problem
I've got a function that I want to reference and use across different scripts. Is there any way to do this? I don't want to be re-writing the same function for different scripts. Thanks.