Hi, I'm writing a simple terminal emulator (on linux using standard pty libraries) and have run across some behavior in bash that I cannot explain after several weeks of reading documentation.
When I run a different shell, say zsh, it behaves the way I expect an interactive shell would. As characters are sent to the shell to build the command, the shell sends the characters back to the terminal to display. However with bash, the shell doesn't respond at all until a <CR> is sent, and then bash only sends the output of the command, not the command itself. If my terminal emulator is expecting the shell to provide all display text, it wouldn't show the commands at all. In all other ways, bash behaves like an interactive shell. My ...rc files are used correctly, and I can effectively launch and interact with other programs. The oddest part of all is that bash will start behaving like zsh if I run zsh, then exit back to bash, even though it's still the same process with the same environment. Can anyone explain why bash is operating in one mode or the other, and how I can explicitly set this behavior one way or the other? Thanks! Nico Here is log showing this. ------------------------------------------------ bash: no job control in this shell [BASH nra...@sofia:~]$ <- <CR> [BASH nra...@sofia:~]$ pwd <- pwd<CR> /home/nraffo <- # bash only sends back pwd output [BASH nra...@sofia:~]$ zsh <- zsh<CR> [ZSH nra...@sofia:~]$ <- <CR> <- # zsh repeats the command [ZSH nra...@sofia:~]$ pwd <- pwd<CR> pwd <- # zsh repeats the command /home/nraffo [ZSH nra...@sofia:~]$ exit <- exit<CR> exit <- # zsh repeats the command [BASH nra...@sofia:~]$ <- <CR> <- # now bash also repeats the command [BASH nra...@sofia:~]$ pwd <- pwd<CR> pwd <- # bash repeating command /home/nraffo [BASH nra...@sofia:~]$ ----------------------------------------------- Restarting in no-repeat mode: (These don't change after going in and out of zsh) ----------------------------------------------- bash: no job control in this shell [BASH nra...@sofia:~]$ [BASH nra...@sofia:~]$ set BASH=/bin/bash BASH_ARGC=() BASH_ARGV=() BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="3" [1]="00" [2]="15" [3]="1" [4]="release" [5] ="x86_64-redhat-linux-gnu") BASH_VERSION='3.00.15(1)-release' COLORS=/etc/DIR_COLORS COLUMNS=168 DIRSTACK=() EDITOR=vi EUID=455 GROUPS=() G_BROKEN_FILENAMES=1 HISTFILE=/home/nraffo/.bash_history HISTFILESIZE=1000 HISTSIZE=1000 HOME=/home/nraffo HOSTNAME=sofia.XXXXXXX.com HOSTTYPE=x86_64 IFS=$' \t\n' INPUTRC=/etc/inputrc LANG=en_US.UTF-8 LESSOPEN='|/usr/bin/lesspipe.sh %s' LINES=44 LOGNAME=nraffo LS_COLORS= MACHTYPE=x86_64-redhat-linux-gnu MAIL=/var/spool/mail/nraffo MAILCHECK=60 MYVIMRC=/home/nraffo/.vimrc OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/ home/nraffo/bin PIPESTATUS=([0]="0") PPID=31674 PS1='[BASH \...@\h:\w]$ ' PS2='> ' PS4='+ ' PWD=/home/nraffo SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive- comments SHLVL=3 SSH_CLIENT='10.10.0.64 50457 22' SSH_CONNECTION='10.10.0.64 50457 10.10.1.14 22' SSH_TTY=/dev/pts/1 SUPPORTED=en_US.UTF-8:en_US:en TERM=dumb TERMCAP=COLUMNS=168 UID=455 USER=nraffo VIM=/home/nraffo/.mybin/vim72/share/vim VIMRUNTIME=/home/nraffo/.mybin/vim72/share/vim/vim72 VIMSHELL=1 _=env [BASH nra...@sofia:~]$