Thread View: gnu.bash.bug
3 messages
3 total messages
Started by James J Dempsey
Mon, 10 Jul 1989 22:40
echo -n does
Author: James J Dempsey
Date: Mon, 10 Jul 1989 22:40
Date: Mon, 10 Jul 1989 22:40
21 lines
1008 bytes
1008 bytes
I'm running bash 1.02 under Ultrix 3.0 on a VAX 8530 compiled with GCC 1.35.
The "-n" option of the builtin echo doesn't seem to suppress a newline
at the end. However, using \c with -e does seem to suppress the
newline. I couldn't figure out the problem from a quick look at the
code since -n and \c seem to do the same thing.
The -n option worked fine in 1.01 but it looks like the argument
parsing for echo_builtin has changed since then.
$ echo foo
foo
$ echo -n foo
foo
$ echo -e 'foo\c'
foo$
--Jim Dempsey--
BBN Communications
jjd@bbn.com (ARPA Internet)
..!{decvax, harvard, wjh12, linus}!bbn!jjd
echo -n does
Author: Brian Fox
Date: Mon, 10 Jul 1989 22:57
Date: Mon, 10 Jul 1989 22:57
33 lines
1338 bytes
1338 bytes
Date: Mon, 10 Jul 89 18:40:46 -0400
From: James J Dempsey <jjd@bbn.com>
I'm running bash 1.02 under Ultrix 3.0 on a VAX 8530 compiled with GCC 1.35.
The "-n" option of the builtin echo doesn't seem to suppress a newline
at the end. However, using \c with -e does seem to suppress the
newline. I couldn't figure out the problem from a quick look at the
code since -n and \c seem to do the same thing.
Yeah, sorry about that. In builtins.c, function echo_builtin (), the
segment of code reading:
while (*temp)
{
if (*temp == 'n')
display_return == 0;
#ifdef V9_ECHO
else if (*temp == 'e')
should read:
while (*temp)
{
if (*temp == 'n')
display_return = 0;
#ifdef V9_ECHO
else if (*temp == 'e')
i.e., the test "display_return == 0" should be an assignment.
brian
Re: echo -n does
Author: Chet Ramey
Date: Mon, 10 Jul 1989 23:16
Date: Mon, 10 Jul 1989 23:16
51 lines
2425 bytes
2425 bytes
In article <8907102240.AA00404@life.ai.mit.edu> jjd@BBN.COM (James J Dempsey) writes:
>The "-n" option of the builtin echo doesn't seem to suppress a newline
>at the end. However, using \c with -e does seem to suppress the
>newline. I couldn't figure out the problem from a quick look at the
>code since -n and \c seem to do the same thing.
It's a typo. Here's a diff for it which also fixes another bug in the
echo builtin (your line numbers may vary):
*** bash-1.02/builtins.c Wed Jul 5 21:25:49 1989
--- src-1.02/builtins.c Mon Jul 10 18:51:00 1989
***************
*** 980,984 ****
{
if (*temp == 'n')
! display_return == 0;
#ifdef V9_ECHO
else if (*temp == 'e')
--- 981,985 ----
{
if (*temp == 'n')
! display_return = 0;
#ifdef V9_ECHO
else if (*temp == 'e')
***************
*** 1021,1027 ****
case '4': case '5': case '6': case '7':
c -= '0';
! if (*s >= 0 && *s <= '7')
c = c * 8 + (*s++ - '0');
! if (*s >= 0 && *s <= '7')
c = c * 8 + (*s++ - '0');
break;
--- 1022,1028 ----
case '4': case '5': case '6': case '7':
c -= '0';
! if (*s >= '0' && *s <= '7')
c = c * 8 + (*s++ - '0');
! if (*s >= '0' && *s <= '7')
c = c * 8 + (*s++ - '0');
break;
Chet Ramey
Chet Ramey "We are preparing to think about contemplating
Network Services Group, CWRU preliminary work on plans to develop a
chet@cwjcc.INS.CWRU.Edu schedule for producing the 10th Edition of
the Unix Programmers Manual." -- Andrew Hume
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads