As people point out, Bash does not allow variables starting with numbers. However, it passes an unrecognized environment string to external programs, so the variable maps to env , but not to set .
As a workaround, you can work with a valid name like _64bit , and then automatically enter your invalid variable name in the commands that you run:
#!/bin/bash # Setup for injection hack original=$PATH PATH="/" command_not_found_handle() { PATH="$original" env "64bit=$_64bit" " $@ " } # Your script and logic _64bit="some dynamic value" # This verifies that '64bit' is automatically set env | grep ^64bit
Note that this particular method only works when called through $ PATH, and not when using relative or absolute path names.
If you are calling by path name, consider changing PATH and calling by name.
source share