Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have a bash script A from which I'd like to call bash script B. I'd like to declare a number of paths in B, call B from A and fetch the paths..is it possible? If so, how do I achieve it? The scripts are located in the same folder.
Maybe it would be easier to just source the scriptB from scriptA?
. ./scriptB
This way they are run in same shell and all variables are shared.
Add a comment
There are several ways of doing this. One way is to echo the paths in scriptB and set a variable in scriptA to capture the output:
In scriptA
paths=$(./scriptB)
Required, but never shown
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.
Explore related questions
See similar questions with these tags.