Monday, July 11, 2005

completion for directories starting with '='

Initially i thought this could be a bug but later realised that this behavior is because of readline treating '=' as a word break character.

# mkdir =foo =foobar
# cd =\=foo
-bash: cd: ==foo: No such file or directory


Basically when you hit TAB after types just '=' , bash adds "\=foo".
What is treated as a word break character can be modified by changing the value of COMP_WORDBREAKS(Thanks to Chet :) ).

$ echo $COMP_WORDBREAKS
"'@><=;|&(:
$ COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
$ echo $COMP_WORDBREAKS
"'@><;|&(:

Also you just saw bash's search and replace functionality.If there is no "slash" in the end ,the pattern is deleted from the variable :).

0 Comments:

Post a Comment

<< Home