Suppose I have foo.sh
that calls bar.sh
using parallel:
# foo.sh
#! /bin/bash
parallel -N 3 bar.sh ::: $(seq 10)
My bar.sh
works like this: if there is an environment variable (e.g. DEBUG=1) set, then it will output lots of debug info.
Ideally I want to simply execute my foo.sh
like such:
$ DEBUG=1 foo.sh
Normally, foo.sh
has $DEBUG
value, as well as bar.sh
sees it. But now with me using GNU parallel to call bar.sh
, which is a local program, my bar.sh
no longer has the DEBUG
value set.
I read that --env
only works if I had remote execution -S
set, and from me trying it does not seem to work for me.
Is there a way to get my parallel'ed bar.sh
to simply "inherit" the environment settings of my foo.sh
? I really don't want to spell out each and every environment variable and their values when calling bar.sh
in parallel.
TIA