[clug] Programmable title

Bryan Kilgallin bryan at netspeed.com.au
Fri Oct 17 07:05:28 MDT 2014


Thanks guys. The following seems to do what I wanted. Though I don't 
know how to force the terminal to be of type "tty" as opposed to "pts", 
in order to test that condition.

function fish_title
     echo $_ 'shell'
     set teletype (tty | cut -c 6-8)
     if test $teletype = 'pts'
         echo ' pseudo'
     end
     echo ' terminal on line '
     echo (tty) | cut -c 10-
end

Eyal:

I am using the "fish" shell. Its syntax is simpler than that of the 
"bash" shell.

On 17/10/14 23:54, Eyal Lebedinsky wrote:
> Bryan,
>
> Are you sure it says
>     echo (tty) | cut -c 10-
> and not
>     echo $(tty) | cut -c 10-
> or simply, as done earlier
>     tty | cut -c 10-
>
> But regardless, it will not parse a /dev/tty* correctly.
>
> Maybe separate the two cases, like
>
>     case "`tty | cut -c 6-8`" in
>     pts)
>         ...message for a pts...
>         ;;
>     tty)
>         ...message for a terminal...
>         ;;
>     *)
>         echo "on `tty`"
>         ;;
>     esac
>
> Good Night,
>     Eyal
>
> On 17/10/14 23:24, 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.
>

-- 
www.netspeed.com.au/bryan/



More information about the linux mailing list