I have defined a
bash function in my
~/.bashrc file. This allows me to use it in shell terminals. However, it does not seem to exist when I call it from within a script.
How can I define a
bash function to be used by scripts as well?
A better solution would be to source the file containing the function using
Put your function definitions in a file in a known place, and use the
If you want, you can follow ksh's autoload feature. Put each function definition in a file with the same name as the function. List the directories containing the function definitions in the
Do you need a function? If not, consider pulling out the logic into a separate, stand-alone Bash script in your
I like having