Reputation: 1245
I am using bash script to call a function in a different file. But, the function didn't seem to run. I couldn't figure out what's the issue here. The following is part of the script:
#!/bin/bash
source utility
res=$(InterCombinations)
File: utility
InterCombinations()
{
...
echo "InterCombinations is called"
}
Please let me know if you need more info.
Thanks.
Upvotes: 2
Views: 229
Reputation: 72
The scripts will work provided the utility file is in the current working directory. You could put or echo the variable:
set -x
in your main script to watch the steps in execution:
#!/bin/bash -ex
set -x
source utility
res=$(InterCombinations)
You are saving the output of your called function on to a variable and not echoing/printing it on to the "stdout".
Upvotes: 2