5

I have a Projection function in my bash_profile. Now I am trying to call this function from a bash script however I get a not found error. How do I make the projection function visible to the bash script?

2 Answers 2

2

You must export the function

export -f foo

ref

Sign up to request clarification or add additional context in comments.

1 Comment

where does the export statement go?
0

The sane but not necessarily elegant approach is to put the function in a separate file, and source it from your profile and from your script.

You need to export the function if you want to make it available to all your scripts, but -- as with global variables -- this is not very maintainable in the long run.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.