Skip to content

Instantly share code, notes, and snippets.

@lgoldstien
Last active August 19, 2020 16:10
Show Gist options
  • Save lgoldstien/8453726 to your computer and use it in GitHub Desktop.
Save lgoldstien/8453726 to your computer and use it in GitHub Desktop.
A simple script to load workspace specific environment variables and the like.
#!/bin/bash
function workspace_cd() {
cd $@ && [ -f ".workspace" ] && source .workspace
}
alias cd="workspace_cd"
@lgoldstien
Copy link
Author

Source this in your .profile

@lgoldstien
Copy link
Author

Any directory you cd into that has a .workspace file inside will cause the .workspace file to be sourced.

@lgoldstien
Copy link
Author

A demonstraion of a .workspace file could be:

export GOPATH=/Users/lg/Documents/Projects/SomeGoProject
export PATH=$PATH:$GOPATH/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment