Altering the environment just for a single command is very simple:
DB=postgresql some_command --with --arguments
Unfortunately, I have to do this on a remote server and due to limitations of the deployment, I can only edit what comes after the some_command. The following would be nice, but doesn’t do the trick (in Bash):
some_command --with --arguments DB=postgresql
Is there some other Bash hack to get there?
Here’s another idea, a bit wild I’m afraid:
The idea is that the backquoted command will actually do what you want. The first
some_commandis only there so the command will start as you want it. You should find parameters that would make it do something harmless.If you have nothing equivalent for the
--do-nothingparameter, you can do this:Where
ps-grep-killis a combination of these commands (I leave the details as an exercise), which finds the parent process, which is just about to runsome_command, and kills it before it gets a chance to (but after the backquotedsome_commandhas run already).