I recently migrated all my dotfiles and setting to a new laptop running Ubuntu 13.04, and have been noticing a strange behavior that I've never seen before. Essentially, it seems like my terminal is sometimes trying to parse commands from right to left rather than the normal way. Its not consistant at all, and often typing the same command twice will produce different output.
Example:
⋯ www localwork cd ~/Downloads
bash: /home/goldenapples/Downloads: Is a directory
~ cd ~/Downloads
~ Downloads ls
So, the first command seems to have been parsed as cd ~; Downloads, but the second time I typed the same exact command, it worked fine.
The same thing happens with aliases. Here I have gp aliased to git push:
~ Documents infostats-theme master gp
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[-c name=value] [--help]
<command> [<args>]
[...]
See 'git help <command>' for more information on a specific command.
The program 'push' is currently not installed. You can install it by typing:
sudo apt-get install heimdal-clients
~ Documents infostats-theme master gp
Counting objects: 22, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.69 KiB, done.
Total 14 (delta 12), reused 0 (delta 0)
To [email protected]:janrain/statboard.git
cf86529..3208e21 HEAD -> master:wq
No idea what happened there. My bash aliases were processed in the first example, and it correctly read the line as git push, but I don't knwo what happened after that. Looks like it tried to parse the command as git; push; and so it showed the git help screen, and then displayed an error that no program named push was installed. The werid thing is: typing the same exact command immediately afterwards worked fine.
This is one of those problems I've just been putting up with because it makes no sense. The only thing I can seem to pinpoint is that the problem behavior seems to happen when I'm typing especially fast, and slowing down and retyping the command sometimes makes it work.
I'm mostly using Bash inside of tmux 1.8, if that lends any help.
Update:
Adding this line to my .tmux.conf:
set-option -g default-command "exec /bin/bash --norc"
seems to have fixed the problem... or at least I haven't been able to cause it again since. But I still have no idea why or how, and I'd love an explanation.
bash --norc? Does it happen if you move~/.inputrcouti of the way? Does it happen outside tmux?.bashrcfixes the issue, then it's something there causing it. So post your.bashrc. Given that the bug comes up inside an alias, I think this has to be a bug in bash. Hmmm… does the bug survive a reboot? Have you run a memory test recently (pick memtest at the Grub prompt and let stew overnight)?