Last active
February 6, 2016 20:16
-
-
Save coldnebo/e74763de93ff0ad0be89 to your computer and use it in GitHub Desktop.
how I manage my paths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pathadd() { | |
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then | |
PATH="${PATH:+"$PATH:"}$1" | |
fi | |
} | |
pathoverride() { | |
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then | |
PATH="$1${PATH:+":$PATH"}" | |
fi | |
} | |
# remote to ubuntu | |
function rpwd { | |
local name=`pwd` | |
[[ "$name" =~ ^"$HOME"(/|$) ]] && name="~${name#$HOME}" | |
echo $name | |
} | |
# example use | |
# to change dir from mac /Users/lkyrala to /home/lkyrala automatically using the above rpwd. | |
alias ss='ssh lkyrala@ubuntu "cd `rpwd`; /bin/bash -i"' | |
# mac centric (acts like ubuntu with a twist): | |
# on prompt, only show the current directory, but in the window title | |
# show the entire path. prepended by user@machinename | |
PS1="\u@\h:../\W$ " | |
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}: ${PWD}\007"' | |
pathoverride $HOME/bin | |
export NODE_HOME=/local/node | |
pathadd $NODE_HOME/bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment