bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash cannot print string "^-e"


From: Justin Piszcz
Subject: Re: bash cannot print string "^-e"
Date: Fri, 11 Jul 2003 12:24:38 -0400 (EDT)

Ah without any '' options or such I see now, ok.

On Sat, 12 Jul 2003, naOYA-OYAma wrote:

> Hello Justin
>
> I am sorry to have transmitted from the contents understood accidentally.
>
> I want to print  "-e" and "-n" by builtin echo.
> ## regex : /^-[enE]$/
>
> To make it output by the echo command, it can do nothing but be assumed,
> "echo -e \\055\\145" and "echo -e \\055\\156".
>
> In the rm command, there is "--" option.
> I want you to take this to the echo command.
>
> Thank you.
>
> On Fri, 11 Jul 2003 11:17:30 -0400 (EDT)
> Justin Piszcz <address@hidden> wrote:
>
> > address@hidden:~$ echo '-e -n'
> > -e -n
> > address@hidden:~$
> >
> >
> > On Sat, 12 Jul 2003, naOYA-OYAma wrote:
> >
> > > Configuration Information [Automatically generated, do not change]:
> > > Machine: i386
> > > OS: linux-gnu
> > > Compiler: gcc -static
> > > Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
> > > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-turbo-linux-gnu' 
> > > -DCONF_VENDOR='turbo' -DSHELL -DHAVE_CONFIG_H 
> > > -DNON_INTERACTIVE_LOGIN_SHELLS -D_FILE_OFFSET_BITS=64  -I.  -I. 
> > > -I./include -I./lib -I/usr/include -O2 -march=i586
> > > uname output: Linux unicorn.minaminoshima.org 2.4.18-8usb #4 木 12月 19 
> > > 00:26:27 JST 2002 i686 unknown
> > > Machine Type: i386-turbo-linux-gnu
> > >
> > > Bash Version: 2.04
> > > Patch Level: 0
> > > Release Status: release
> > >
> > > Description:
> > > builtin command of echo cannot print "-e" string.
> > > echo cannot print option string "-e, -n".
> > >
> > > Repeat-By:
> > > $ echo -e
> > >
> > > $
> > > $ echo -e -e
> > >
> > > $
> > > $ echo -- -e
> > > -- -e
> > > $
> > > $ echo -e \\055\\145
> > > -e
> > >
> > >
> > > Fix:
> > > i make a patch for bash-2.05.
> > > this patch adds an option  like -- of rm(1).
> > >
> > > --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--
> > > --- bash-2.05/builtins/echo.def   Fri Dec 17 21:12:40 1999
> > > +++ bash-2.05/builtins/echo.def.new       Mon Aug 27 22:26:41 2001
> > > @@ -62,9 +62,9 @@
> > >  $END
> > >
> > >  #if defined (V9_ECHO)
> > > -#  define VALID_ECHO_OPTIONS "neE"
> > > +#  define VALID_ECHO_OPTIONS "neE-"
> > >  #else /* !V9_ECHO */
> > > -#  define VALID_ECHO_OPTIONS "n"
> > > +#  define VALID_ECHO_OPTIONS "n-"
> > >  #endif /* !V9_ECHO */
> > >
> > >  /* System V machines already have a /bin/sh with a v9 behaviour.  We
> > > @@ -85,11 +85,12 @@
> > >  echo_builtin (list)
> > >       WORD_LIST *list;
> > >  {
> > > -  int display_return, do_v9, i, len;
> > > +  int display_return, do_v9, i, len, ignore_option;
> > >    char *temp, *s;
> > >
> > >    do_v9 = xpg_echo;
> > >    display_return = 1;
> > > +  ignore_option = 1;
> > >
> > >    for (; list && (temp = list->word->word) && *temp == '-'; list = 
> > > list->next)
> > >      {
> > > @@ -114,6 +115,9 @@
> > >   {
> > >     switch (i)
> > >       {
> > > +     case '-':
> > > +       ignore_option = 0;
> > > +       goto just_echo;
> > >       case 'n':
> > >         display_return = 0;
> > >         break;
> > > @@ -143,10 +147,10 @@
> > >     if (do_v9)
> > >       {
> > >         for (s = temp; len > 0; len--)
> > > -         putchar (*s++);
> > > +         ignore_option ? putchar (*s++):0;
> > >       }
> > >     else
> > > -     printf ("%s", temp);
> > > +     ignore_option ? printf ("%s", temp):0;
> > >  #if defined (SunOS5)
> > >     fflush (stdout);      /* Fix for bug in SunOS 5.5 printf(3) */
> > >  #endif
> > > @@ -159,8 +163,11 @@
> > >     display_return = 0;
> > >     break;
> > >   }
> > > -      if (list)
> > > +      if (list&&ignore_option)
> > >   putchar(' ');
> > > +      else
> > > + ignore_option = 1;
> > > +
> > >      }
> > >
> > >    if (display_return)
> > > --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--
> > >
> > >
> > >
> > > _______________________________________________
> > > Bug-bash mailing list
> > > address@hidden
> > > http://mail.gnu.org/mailman/listinfo/bug-bash
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]