Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Last active August 26, 2018 14:18
Show Gist options
  • Save GeneralD/4f3eacacabbfc723b11eba406d274790 to your computer and use it in GitHub Desktop.
Save GeneralD/4f3eacacabbfc723b11eba406d274790 to your computer and use it in GitHub Desktop.
[parent-directory.zsh] #Shell #Ruby
# cd to parent directory of the file (even if it is symbolic link)
function pd() {
local dir=`realpath ${1:-.}`
cd $dir(:A:h)
}
# alias -g ...=../../, ....=../../../, .....=../../../../, ......
`ruby -e "(2..20).each{|i| puts 'alias -g .'+'.'*i+'='+'../'*i}"`
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment