I have an application which modifies environment variables. The intent is to launch a bash shell with a modified context-specific environment.
When my application modifies the environment, and exec()s "bash --noprofile --norc" with the modified environment then I almost get the behavior I want, except that aliases are dropped. If I log in and open a shell directly from the OS, I get the "normal" aliases, but if my application launches a bash, then I don't get any aliases because the initialization files are skipped.
Is there any way to have bash initialize from a dynamic source? In other words, it would be helpful if I could have my application launch "bash" with all its various user/facility settings (including aliases) and then at the end of that, source the differences that my application needs to apply. Ideally, this would leave open a shell prepped and ready to go for my users. I'm not finding this (or perhaps understanding it) from the man page.
In an ideal world, we could refactor the user/factory settings to be more reentrant (aware of the application, and skip reinitialization steps that don't need to happen again); but in practice this is turning out to be a little bit of a hassle.
Any suggestions? Thanks.