4 ms·
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} wher
by bachya 17y ago
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
}