SIGPIPE 13

Programming, automation, algorithms, macOS, and more.

Path Completion (bash)

If you upgraded to Mountain Lion and often want to cd into ~/Library/Application Support you might be a little annoyed by the new Application Scripts directory that makes the normal ~/Library/Ap⇥ stop at ~/Library/Application S‸ to have you disambiguate the path.

To avoid this you can set the FIGNORE variable. From man bash:

FIGNORE
    A colon-separated list of suffixes to ignore when 
    performing filename completion (see READLINE below). A 
    filename whose suffix matches one of the entries in 
    FIGNORE is excluded from the list of matched file- 
    names. A sample value is ".o:~".

So if you set this in your bash startup file:

FIGNORE=".o:~:Application Scripts"

Then it will completely ignore that folder and do the full expansion.

Some other useful variables you can set in ~/.inputrc that (IMHO) improve the default behavior of filename completion:

completion-ignore-case (Off)
    If set to On, readline performs filename matching and 
    completion in a case-insensitive fashion.

mark-symlinked-directories (Off)
    If set to On, completed names which are symbolic links 
    to directories have a slash appended (subject to the 
    value of mark-directories).

show-all-if-ambiguous (Off)
    This alters the default behavior of the completion 
    functions. If set to On, words which have more than one 
    possible completion cause the matches to be listed 
    immediately instead of ringing the bell.

So my recommendation is to go with this:

set completion-ignore-case on
set mark-symlinked-directories on
set show-all-if-ambiguous on

The ignore case allows you to type ~/l⇥ and still get ~/Library/.

Marking symlinked directories is useful for /tmp, /etc, and /var.

Showing all when ambiguous instead of ringing the bell… who came up with these defaults?

{{ numberOfCommentsTitle }}

{{ submitComment.success }}

Error Posting Comment

{{ submitComment.error }}