[clug] Pseudoterminal

Bryan Kilgallin (iiNet) kilgallin at iinet.net.au
Mon Sep 4 23:53:28 UTC 2017


My default shell is fish. And my "config.fish" file starts with a 
"fish_title" function.

{When using most virtual terminals, it is possible to set the message 
displayed in the titlebar of the terminal window. This can be done 
automatically in fish by defining the fish_title function.}

https://fishshell.com/docs/current/index.html

It starts by stating the number of the pseudoterminal. Currently that's 
saying "Pseudoterminal 1".
{
echo "Pseudoterminal "
	tty | cut -c 10,11
}

A problem arose when I tried to distinguish between pseudoterminal 
interfaces tty and pts. If the former were in use, then I wanted the 
terminal title line to begin "Terminal "... instead.

But I got into all manner of bother when I tried lines like the following.
{
if tty | cut -c 6-8 'tty' echo "Terminal "
}
-- 
www.netspeed.com.au/bryan/



More information about the linux mailing list