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


Reply via email to