Re: RH9 breaks bash ?

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

 



On Mon, 2003-12-29 at 18:11, Tim Mooney wrote:
> Do relics like SunOS 4.1.3 have a printf binary?  I don't believe it was
> built in to the /bin/sh or /5bin/sh.  Every UNIX I've ever seen has an
> `echo' (either builtin or external to the shell), but I don't believe they
> all have `printf'.  Not a concern if you only need to deal with modern
> systems.
According to http://www.in-ulm.de/~mascheck/various/echo/ SunOS 4 does
not have printf, but most others do.

There are several other ways to set the title. Replace the
hostname|sed;echo with
    hostname | awk -F. '{printf("\033]2;%s\007\033]1;%s\007", $1, $1)}'
the -F. splits the input on periods, and the printf does the work of
echo. In case some old version of awk does not support the \nnn format,
you can use
    hostname | awk -F. '{printf("%c]2;%s%c%c]1;%s%c", 27, $1, 7, 27, $1, 7)}'

Another is to embed the control characters directly into the string

#!/bin/sh
echo "^[]2;$*^G^[]1;$*^G\c"

You can type the control characters in vi with Control-V Escape, and
Control-V Control-G, or emacs with Control-Q...  I do it this way (I
don't remember which system forced me this way, HPUX or Irix most
likely). I put these into a separate script because the simple act of
viewing the file (more, less, cat) will change the title and icon. Of
course, this takes you directly into the differences in ways that echo
suppresses newlines - or not in the case of posix.2.

Enough off topic chat (from me anyway :)

-- 
  enjoy
    scott


_______________________________________________
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