[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cd multiple levels up?
From: |
Greg Wooledge |
Subject: |
Re: cd multiple levels up? |
Date: |
Mon, 14 Jun 2010 08:37:36 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Jun 13, 2010 at 06:46:56AM -0500, Peng Yu wrote:
> Hello,
>
> I frequently need do cd multiple levels up. For example,
>
> cd ../..
> cd ../../../../
>
> It would be convenient to type something like "cd 2" or "cd 4". Is
> there a command for this?
You could write a function:
cdup() {
local i
for ((i=1; i<=$1; i++)); do
cd ..
done
}