Re: RH9 breaks bash ?

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

 



> >   MY_HN=`hostname | sed -e 's/\..*//' `
> >   MY_TITLES="\0033]2;$MY_HN\0007\0033]1;$MY_HN\0007"
> >   /bin/echo "${MY_TITLES}\c"
> >
> >which used to set the xterm window and icon titles, now just echos
> >the uninterpreted string:
> >
> >    \0033]2;cricket\0007\0033]1;cricket\0007\c
>
> It's probably the echo, not the other stuff.  When I run your commands
> on a Solaris box, with bash 2.05b, and do
>
> 	echo "${MY_TITLES}\c"
>
> I get the backslashed output.  If I instead run
>
> 	builtin echo -e "${MY_TITLES}\c"
>
> I get your expected result.

/bin/echo, echo alone, and "builtin echo" all produce identical
(wrong) results on RH9:

    [cricket : phutchis]$ echo "${MY_TITLES}\c"
    \0033]2;cricket\0007\0033]1;cricket\0007\c
    [cricket : phutchis]$ /bin/echo "${MY_TITLES}\c"
    \0033]2;cricket\0007\0033]1;cricket\0007\c
    [cricket : phutchis]$ builtin echo "${MY_TITLES}\c"
    \0033]2;cricket\0007\0033]1;cricket\0007\c

"echo -e" works on RH9, but not on any of the other systems I use.

> >How can I restore the previous behavior?  Changing the .bashrc is
> >probably not a viable approach, because it still needs to work on
> >a variety of systems, some of which have older versions of bash.
>
> Well, changing your personal .bashrc seems like a more viable approach
> than trying to change the system shell.

To me, fixing the breakage in a new release seems more viable than
constructing an exponentially-exploding maze of workarounds.  I was
hoping for something like a "set" command that would cause the new
bash (or echo) to behave like the old one.

> Why not detect what platform and version of bash you have, and
> then customize how bash acts and what options you give it based
> on what you've detected?
>
> Look at $BASH_VERSION, $HOSTTYPE, $OSTYPE, and other variables that
> bash sets for you, and customize your .bashrc based on those.

I suppose I could do something like

  if [system is RH9]; then
     ECHO_CMD="echo -e"
  else
     ECHO_CMD=/bin/echo
  fi
  ...
  $ECHO_CMD "${MY_TITLES}\c"

but what do I put inside the [], that will run on all systems,
to reliably identify "Red Hat 9"?  Apparently $BASH_VERSION is
irrelevant, and $OSTYPE on RH9 just says "linux-gnu".


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux