Francesco Montorsi wrote: > PROMPT_COMMAND='echo -ne "\033]0;${PWD/$HOME/~}\007"'
That looks okay to me. It sets the working directory as the xterm window title. > PS1='${debian_chroot:+($debian_chroot)}\[\033[01;[EMAIL > PROTECTED]:\[\033[01;34m\]\w\[\033[00m\]\$ > ' > what is it btw? That is a pretty standard Debian setting that looks to see if you are running inside of a chroot. Normally inside of a chroot on Debian systems the file /etc/debian_chroot has been set (I wish it were a more generic name) to the name of the chroot. That is used to set the debian_chroot variable. The variable setting is used in the prompt itself. You have the color prompt setting uncommented which is pretty gnarly. The non-color one is easier to understand. PS1='${debian_chroot:+($debian_chroot)[EMAIL PROTECTED]:\w\$ ' It simply places the value of the variable if it is set in the prompt inside parenthesis. If it is not set then it reduces simply to the basic '[EMAIL PROTECTED]:\w\$ '. > ok, but this problem does not only happen with "cat". It happens with > _any_ program which does not print a newline: I only expect to see the prompt once. Example: $ printf "hello " hello $ The prompt, once, after the previous output is normal. > [EMAIL PROTECTED]:~$ ./test > [EMAIL PROTECTED]:~$ thout final [EMAIL PROTECTED]:~$ I don't know why you are getting two prompts. There are two separate issues. One is that you think that the shell should be able to dynamically determine the cursor location and add a newline if it is not already in the first column. I disagree. The shell should not do that. If you want the shell to always add an extra newline then you can always add one to your PS1 setting. Some people do that and like that configuration. Second is that you think there should only be one prompt printed in that case. I agree. But I cannot recreate your behavior here and I cannot think of how that would come about. I am afraid you will have to try to debug it further on your end. Unless someone else on the mailing list pops up with a better idea. Try reducing your environment to the minimum by unsetting PROMPT_COMMAND and setting PS1 to '\$ ' and similar. The values you showed looked okay to me though. > same weird behaviour I see when using cat with non-newline-ended files. Right. That is the way it is supposed to work. After the command has output whatever the command outputs then the shell emits the prompt. If the PROMPT_COMMAND is set then before emitting the prompt the value of the $PROMPT_COMMNAND is output. If the previous command did not terminate with newline then the prompt will be output not at the left of the line but immediately after the previous output. > Interestly, if the main() just returns 0 and does not printf() anything, > then the prompt is correctly printed... Correct. There was no output at all in that case. You can simulate that case with true, false or any other empty command. $ true $ Bob _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash