HN user

bachya

1 karma
Posts0
Comments1
View on HN
No posts found.

Can't remember where I found this, but this function allows you to go up any level of dirs without specifying an infinite number of aliases.

Usage: up {x} where x is the number of directories you want to go up (e.g., 3)

function up() { local arg=${1:-1} local dir="" while [ $arg -gt 0 ]; do dir="../$dir" arg=$(($arg - 1)); done cd $dir >&/dev/null }