Skip to content

Instantly share code, notes, and snippets.

@skarr
Created March 14, 2014 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skarr/9543047 to your computer and use it in GitHub Desktop.
Save skarr/9543047 to your computer and use it in GitHub Desktop.
Node.js Project Environment Setup
#!/usr/bin/env bash
# Vars
BASH_BIN=`which bash`
SCRIPT_DIR=$(dirname "$(readlink -f $0)")
# Interpolated variables
read -r -d '' SOURCE_A << EOF
#!/bin/env bash
SCRIPT_DIR=$SCRIPT_DIR
EOF
# No evaluation
read -r -d '' SOURCE_B << 'EOF'
source ~/.profile
PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w(env)\$ "
PATH=$SCRIPT_DIR/node_modules/.bin:$PATH
EOF
# Concat source files
SOURCE_FILES="$SOURCE_A
$SOURCE_B"
# Run bash setup
$BASH_BIN --init-file <(echo "$SOURCE_FILES")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment