[clug] Programmable title

Luke Mewburn luke at mewburn.net
Fri Oct 17 06:33:57 MDT 2014


On Fri, Oct 17, 2014 at 11:24:46PM +1100, Bryan Kilgallin wrote:
  | I have the following in the config.fish file.
  | 
  | function fish_title
  |     echo $_ 'shell '
  |     tty | cut -c 6-8
  |     echo ' on line '
  |     echo (tty) | cut -c 10-
  | end
  | 
  | So the terminal window title reads as follows.
  | 
  | "fish shell pts on line 0"
  | 
  | I would like that to substitute instead of "pts" rather "pseudo terminal".
  | In the case of being a "tty", then I'd like the title to say
  | "terminal" instead.


The following /bin/sh using a case and variable manipulation works:
    t=$(tty)
    case "$t" in
    /dev/pts/*) echo "pseudo terminal on line ${t#/dev/pts/}" ;;
    /dev/*)     echo "terminal on line ${t#/dev}" ;;
    esac

No idea how to translate that to the fish equivalent.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/linux/attachments/20141017/ab5e9e47/attachment.pgp>


More information about the linux mailing list