Hi Raphael,

Raphael Geissert wrote:
This is with checkbashisms -n.

Nope.

According to the checkbashisms manual and according to the Debian Policy Manual section 10.4, echo -n should be
supported. Therefore, this is not a bug. Right?

echo -n must be supported by a suitable 'sh' replacement, i.e. dash.
But here's the reason of the report (taking one of the lines as an example):

$ cat /tmp/foo
PROFILE_RUN_LENGTH=100
SECONDS_DONE=50
echo -n "\r$SECONDS_DONE seconds elapsed, $(($PROFILE_RUN_LENGTH - $SECONDS_DONE)) remaining. \b\b\b\b\b\b\b\b\b"
$ dash /tmp/foo; echo
50 seconds elapsed, 50 remaining.
$ bash /tmp/foo; echo
\r50 seconds elapsed, 50 remaining.         \b\b\b\b\b\b\b\b\b
$ posh /tmp/foo; echo
50 seconds elapsed, 50 remaining.
$ zsh /tmp/foo; echo
50 seconds elapsed, 50 remaining.
$ pdksh /tmp/foo; echo
50 seconds elapsed, 50 remaining.
$ ksh /tmp/foo; echo
\r50 seconds elapsed, 50 remaining.         \b\b\b\b\b\b\b\b\b
$ mksh /tmp/foo; echo
50 seconds elapsed, 50 remaining.

Hope you see what I mean. Although this bug isn't really dash-specific, it usually is when the expected behaviour of echo is to interpret backslashes.

The right way to do this is with printf. E.g.

printf '\r%d seconds elapsed, %d remaining. \b\b\b\b\b\b\b\b\b' "$SECONDS_DONE" "$(($PROFILE_RUN_LENGTH - $SECONDS_DONE))"

Ahhhhh... that sounds OK to me, will fix. Thanks for the hint!



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to