josephwecker / bashrc_dispatch

Launch different bash configurations for Linux vs OSX, interactive vs batch
137 stars 9 forks source link

Make sure not to *un*-set the guard variable #8

Open gaelicWizard opened 3 years ago

gaelicWizard commented 3 years ago

There's two scenarios to guard against: (1) getting loaded more than once during the session, (2) infinite recursion. The original code handled (1), but not (2). The fix from mhmurray handled (2), but not (1). This version should handle both.

Basically, set the variable first then source bashrc_once, and that's it; don't unset it.

Resolves #1.