Skip to content

Instantly share code, notes, and snippets.

@joliss
Created August 13, 2012 14:28
Show Gist options
  • Save joliss/3341227 to your computer and use it in GitHub Desktop.
Save joliss/3341227 to your computer and use it in GitHub Desktop.
Part of my generator script for .bashrc.generated, which is sourced from .bashrc. Allows running slow commands (lots of external calls, like `which`, etc.) without slowing shell startup.
expand_source() {
perl -p -e 's/^source ["'\'']?(.*?)["'\'']?$/`cat $1`/em'
}
(
...
test -f "`which rbenv`" && rbenv init - --no-rehash | expand_source
) > ~/.bashrc.generated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment