[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cd multiple levels up?
From: |
Freddy Vulto |
Subject: |
Re: cd multiple levels up? |
Date: |
Sun, 13 Jun 2010 20:30:29 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Peng Yu <pengyu.ut <at> gmail.com> writes:
> 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?
I've written a `cdots' shell script, providing aliases .. ... .... etc. with
an additional tab completed argument for taking a U-turn, for example:
/usr/local/share$ ... sh<TAB><ENTER>
/usr/share$
Seven functions will be created; 2-8 dots which allow you to move 1-7
directories up, and additional directories down again with tab completion. In
pseudo-code, cdots allows you to do this:
.. [dir] = cd ../[dir]
... [dir] = cd ../../[dir]
.... [dir] = cd ../../../[dir]
..... [dir] = cd ../../../../[dir]
...... [dir] = cd ../../../../../[dir]
....... [dir] = cd ../../../../../../[dir]
........ [dir] = cd ../../../../../../../[dir]
For more information and download, see:
http://fvue.nl/wiki/Bash:_Cdots
Freddy Vulto
http://fvue.nl