I just recently ran into the same question with a variable that needed to be derived before job startup based on the files in the scratch directory.
One thing to remember is that $_CONDOR_SCRATCH_DIR is the same value as $TMPDIR in the job environment, in case that helps.
Hereâs the trick if it doesnât:
Executable = /bin/sh
Transfer_executable = False
Arguments = " -c 'export YOUR_ENV_VARIABLE=$(DOLLAR)_CONDOR_SCRATCH_DIR; exec your_real_executable arg1 arg2 arg3â â
The exec prevents the /bin/sh âc process from hanging around and potentially disrupting the jobâs signal handling. The side effect is that you wonât see condor_exec.exec for your HTCondor job executable name. And needless to say it wonât work on Windows.