Hi, When using 'echo -n' or printf without a final \n, and then using the Up and Down keys to walk through previous commands, bash can get confused about its cursor position (or rather its prompt position) and either leave some stray text in the middle of the line, or overwrite part of its prompt.
An example of the stray text is given in the attached typescript. It was produced with this command: script -t -c 'env -i bash --norc --noprofile' 2>timing and then typing: <space>echo -n "some text"<enter>, <space>, <arrowup>, <arrowdown>, <arrowup>, <arrowdown>, <enter>, <space>, exit<enter> -- without the comma+space pairs of course. (The <space>s are not relevant but are to defeat a bug in the timing.) The first <arrowdown> causes bash to rewrite its prompt at the start of the line (instead of after "some text") and not outputting enough spaces to clear the entire line. Benno
Script started on Tue Aug 12 19:32:29 2008 bash-3.2$ echo -n "some text" some textbash-3.2$ echo -n "some text" bash-3.2$ bash-3.2$ echo -n "some text" bash-3.2$ bash-3.2$ bash-3.2$ exit exit Script done on Tue Aug 12 19:32:57 2008
0.174879 10 0.000330 1 0.750233 1 1.468244 1 0.516277 1 0.499631 1 0.528181 1 0.474733 1 0.507721 1 0.552587 1 0.447074 1 0.581336 1 0.941345 1 0.552650 1 0.487494 1 0.491133 1 0.495713 1 0.459160 1 0.495090 1 0.458761 1 0.552680 1 0.769417 2 1.063406 9 0.000267 10 0.000052 1 1.032821 19 2.756806 43 2.069310 19 2.138690 43 1.340475 2 0.728973 10 0.000175 1 2.576283 1 0.450139 1 0.458798 1 0.389751 1 0.455375 2 0.470640 6