0

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.

2 Answers 2

3

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.

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

Comments

1

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)

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.