I am trying to set an environment variable for Bash. However, I need this to be set before any of the shell's startup scripts (including /etc/profile
), because /etc/profile
acts differently based on the value of this variable.
Specifically, I want to create a shortcut to MinTTy that works like git-bash
, but I need to set the MSYSTEM
environment variable before the shell starts, or at least before it starts processing any startup scripts.
A solution that has MinTTy setting the environment variable before it starts the shell will also be accepted.
Edit:
What I am really looking for is sort of a command-line option to BASH that will set an environment variable, somewhat akin to the -D
option to most C (and other) compilers. This would be a "general case" solution. Alternatively, a similar option (command line or configuration) to MinTTy will also do the job.
For my specific need, I have an idea for a potential work-around: Run a BASH script - with no startup scripts - that sets my required variable and exec
s another shell as a login shell.