Bash variable expansion on tab complete

Found the bug report, please register (if not already registered) and add yourself to the ‘people affected’ list, I just did: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/778627 Workarounds Try enabling direxpand or cdable_vars: shopt -s direxpand # or shopt -s cdable_vars Apparently EscTab might be a workaround: I haven’t found a proper solution to this, but there’s a workaround. The … Read more

bash completion of makefile target

Add this in your ~/.bash_profile file or ~/.bashrc file complete -W “\`grep -oE ‘^[a-zA-Z0-9_.-]+:([^=]|$)’ ?akefile | sed ‘s/[^a-zA-Z0-9_.-]*$//’\`” make This searches for a target in your Makefile titled ‘Makefile’ or ‘makefile’ (note the capital ? wildcard in ?akefile) using grep, and pipes it over to the complete command in bash which is used to specify … Read more

A confusion about ${array[*]} versus ${array[@]} in the context of a bash completion

[*] (This is an expansion of my comment on Kaleb Pederson’s answer — see that answer for a more general treatment of [@] vs [*].) When bash (or any similar shell) parses a command line, it splits it into a series of “words” (which I will call “shell-words” to avoid confusion later). Generally, shell-words are … Read more

Git tab completion not working in zsh on mac

TL;DR one-liner echo ‘autoload -Uz compinit && compinit’ >> ~/.zshrc && . ~/.zshrc this will enable completion in .zshrc and apply the setting to your current terminal session. Explanation: Actually, ZSH does know how to do git completion out of the box, but you need to turn on the completion feature itself (which from the … Read more