bash refuses to give me the output of 'bind -p' when I pass it in with the -c switch:
bash -c 'bind -p'
but it works to type
bind -p
directly at the bash prompt, and it works to type something like
bash -c 'echo "hi"'
and zsh happily does exactly what bash refuses to do (well, the equivalent command in zsh):
zsh -c 'bindkey -L'
What on earth is going on???
When you run
bash
with the-c
option,bash
runs in non-interactive mode. Apparently, thebind
builtin doesn't generate output when bash is in non-interactive mode. You can forcebash
to interactive mode by giving the-i
option. The following works for me:OK, I have a partial answer that I just discovered after entering my question...
If I type
then it gives the output of the bind command. It seems that for some reason bash doesn't have a default key map, which is really odd.
(I had had something sourced by my .bash_profile which had an error--something that worked fine in zsh but which bash choked on (apparently bash doesn't allow using 'else' in scripts!?)--and so I just disabled it, figuring default settings would be cleaner anyway.)
It's almost unthinkable that bash doesn't default to either a vi or an emacs keymap. Or is there something else going on that is escaping me?