Mastodon Feed: Post

Mastodon Feed

Reblogged by cstanhope@social.coop ("Your friendly 'net denizen"):

simontatham@hachyderm.io ("Simon Tatham") wrote:

Here's a thing I'd never thought of before about #bash aliases: you don't actually have to put a command in one! I've just found it useful to do this:

alias otherenv=SOME_ENV_VARIABLE=non-default-value

so that the command
otherenv program arg1 arg2...
expands to
SOME_ENV_VARIABLE=non-default-value program arg1 arg2...
and runs the program with the environment variable changed.

(The alias is easier to remember than the actual environment setting, and better still, can be tab-completed.)