22
rated 0 times
[
22]
[
0]
/ answers: 1 / hits: 37890
/ 2 Years ago, sat, november 12, 2022, 10:38:04
I want to get a variable from another script, as demonstrated in this question on Stack Overflow:
How to reference a file for variables in a bash script
However, the answer uses the source
command which is only available in bash
. I want to do this in a portable way.
I have also tried
a.sh
export VAR="foo"
echo "executing a"
b.sh
#!/bin/sh
./a.sh
echo $VAR
But of course that does not work either. How to do this?
More From » command-line