I have 2 bash scripts:
set.sh
export MYVAR="MYVALUE"
get.sh
echo "MYVAR: $MYVAR"
usage
> ./set.sh && ./get.sh
I'm trying to share the variable among the scripts. The real code is more complicated and involves more than 2 scripts, so I cannot call the second script from the first one like that
export MYVAR="MYVALUE"
./get.sh
bashvariables between scripts because they are generally separate processes. You could share by putting the value in Redis which is a "data structure server" that can share integers, strings, hashes, lists, sets, queues, atomics across processes and distributed servers.