Bash cd alias: cdots

From FVue
(Redirected from Bash: Cdots)
Jump to: navigation, search


Cdots is an alternative function for alias ..='cd ..'. Cdots provides aliases .. ... .... etc. with an additional tab completed argument for taking a U-turn, for example:

/usr/local/share$ ... sh<TAB><ENTER>

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, see INSTALL

Copy to your home directory:

cp ~/

Include from within ~/.bashrc:


Also consider putting this in your ~/.inputrc so you only have to press tab once – instead of twice – for completion:

# .inputrc
set show-all-if-ambiguous on  # Produce list of all possible completions at single tab


The download contains an additional test suite. The test suite requires dejagnu, tcl and expect to be installed.

To run the tests:

$> cd test; ./runAll
WARNING: No tool specified
Test Run By freddy on Mon Jun 11 21:54:54 2007
Native configuration is i686-pc-linux-gnu

                ===  tests ===

Schedule of variations:

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
WARNING: Couldn't find tool config file for unix, using default.
Running ./all/all.exp ...

                ===  Summary ===

# of expected passes            308

Release notes



Make sure bash programmable completion is enabled

shopt progcomp > /dev/null || shopt -s progcomp

See also


blog comments powered by Disqus


blog comments powered by Disqus