Skip to content

Instantly share code, notes, and snippets.

@gokhansolak
Last active November 11, 2020 10:44
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 gokhansolak/f189ece1b267400df4c004af1e42137f to your computer and use it in GitHub Desktop.
Save gokhansolak/f189ece1b267400df4c004af1e42137f to your computer and use it in GitHub Desktop.
Source the workspace of the current working directory automatically, if it matches the pattern. Append this to the .bashrc file.
# source the workspace of the current working directory automatically
home_dir=~/
ws_ptr="(${home_dir}ws/[0-9a-zA-Z ]+)/?"
if [[ $PWD =~ $ws_ptr ]]; then
ws_dir=${BASH_REMATCH[1]}
source $ws_dir/devel/setup.bash
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment