I have a script that increments an environment variable, but it only works if I run it by perpending it with "source" or with a ".". Unfortunately, this means that if I attempt to bind it to a key, I can't seem to use "source" modifier, thus the environment variables don't actually change.
(Assuming an integer TEST already exists within shell environment):
#!/bin/bash let "TEST=$TEST+1" echo $TEST export TEST=$TEST
Ideally this script would increment the test variable, but (if I understand this right) it only does so in the "sub-shell" environment that this scripts spawns when it is run. Is it possible modify an environment variable in this way without using "source"? If not, how else could I accomplish my goal? I'd appreciate any help, thanks!