Ian Phillipps wrote:
>> This is shorter, and *much* more efficient:
>>
>> export PROMPT_COMMAND="perl
>> -e'\$_=\$ENV{PWD};s!/.*(?=/.*/)!...!s;print'"
Andrew Savige wrote:
> Saving two strokes:
> s!/.*(?=/.*/)!...!s
> s!.+(?=/.+/)!...!
> To solve the original problem of putting the string
> into the xterm title, this seems the shortest so far:
> export PROMPT_COMMAND="pwd|perl -pe
> 'chop;s#.+(?=/.+/)#...#;\$_=qq(\e]0;\$_\a)'"
We can save a further 3 strokes by replacing:
chop;\$_=qq(\e]0;\$_\a)
with:
s#(.*)\n#\e]0;\$1\a#
and one more stroke with:
s#^#\e]0;#;y#\n#\a#
So the new leader is:
export PROMPT_COMMAND="pwd|perl -pe
's#.+(?=/.+/)#...#;s#^#\e]0;#;y#\n#\a#'"
Andrew.
- Re: Fun with xterm window titles, or Yet Another golf chal... Newton, Philip
- Re: Fun with xterm window titles, or Yet Another golf chal... Newton, Philip
- Re: Fun with xterm window titles, or Yet Another golf chal... Newton, Philip
- Re: Fun with xterm window titles, or Yet Another golf chal... Andrew . Savige
- Re: Fun with xterm window titles, or Yet Another golf chal... Newton, Philip
- Re: Fun with xterm window titles, or Yet Another golf chal... Andrew . Savige
- Re: Fun with xterm window titles, or Yet Another golf chal... Pense, Joachim
- RE: Fun with xterm window titles, or Yet Another golf chal... Andrew . Savige
- RE: Fun with xterm window titles, or Yet Another golf chal... Andrew . Savige
- RE: Fun with xterm window titles, or Yet Another golf chal... Andrew . Savige
