🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #292

Re: echo -n does

#292
From: Chet Ramey
Date: Mon, 10 Jul 1989 23:16
51 lines
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
Technical Details
Message-ID: <408@cwjcc.CWRU.Edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!agate!ucbvax!tut.cis.ohio-state.edu!cwjcc!kiwi!chet
References: <8907102240.AA00404@life.ai.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!agate!ucbvax!tut.cis.ohio-state.edu!cwjcc!kiwi!chet
From: chet@kiwi.CWRU.EDU (Chet Ramey)
Newsgroups: gnu.bash.bug
Subject: Re: echo -n does
Summary: FIX (just a typo)
Message-ID: <408@cwjcc.CWRU.Edu>
Date: 10 Jul 89 23:16:43 GMT
References: <8907102240.AA00404@life.ai.mit.edu>
Sender: news@cwjcc.CWRU.Edu
Reply-To: chet@kiwi.CWRU.EDU (Chet Ramey)
Distribution: gnu
Organization: CWRU Andrew R. Jennings Computing Center
Lines: 51