Better HN
topnewbestaskshowjobs
Log inSign up

bachya

1 karma · joined Oct 8, 2009 (17y ago) · 1 submissions

Submissions

comment 17y ago · link · parent

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 }