I have a bash script like
# print.sh
# export FOO=test would work too
FOO=test ./foo-proj # Something that cares about FOO (shell script or just a binary)
This works. However, I'm wondering why if I do this...
#print.sh
blah="FOO=test"
$blah ./foo-proj
I get this error ./print.sh: line 2: FOO=test: command not found. It's like bash is now interpreting FOO=test as a command instead of a variable declaration. Is there any way around this?
FOO=echo; blah=FOO; ${!blah} foo → foo, but I don't know if that's what you aim to.