ToxicCode =Home= / =Config Files= / =Shell Scripts= / =Articles= / =Text Files= / =Misc= /
Register | Login | Submit new shell script#!/bin/bash
#Originally by dyscoria from http://bbs.archlinux.org/viewtopic.php?id=56646&p=2
#up is the same as cd ../ up 2 is cd ../../ up 3 ../../../ etc
#place is .bashrc as a function or use as a standalone script
###
up ()
{
[[ $# -eq 0 ]] && cd ..
if [[ $1 =~ ^[0-9]+$ ]] && [[ $1 -gt 0 ]]
then
dirs=1
until [[ $dirs -gt $1 ]]
do
command="${command}../"
dirs=$(($dirs+1))
done
cd $command
command=''
fi
}