|
Prev: Dalai Lama: your smiles charm but your actions harm
Next: china nike factory wholesale Air Max 90,Air Max 95,Air Max180,Air Max 36,nike max ltd
From: jaredsubman on 16 Apr 2008 10:15 I'd like to do is have the short hostname, of the title bar of my putty window in the far upper left-hand corner, followed by the date in the far upper right-hand corner. Currently, this is what I have in my .bashrc: export HOST=$(echo $HOSTNAME |cut -d"." -f1) export DATE=$(date +%a" "%b" "%d) export TERM=xterm printf "\033]0;$HOST%160s$DATE\007" (Also, why would this be 160 and not 80???) It works reasonably well except for when the hostname is too long at which time the date scrolls off the title bar : What I would really like to do for the date piece is something like this: printf "%80s" "$DATE" which keeps the DATE right-justified at the command prompt but not in my .bashrc. What am I doing wrong? Any help would be much appreciated. Thanks in advance.
From: Glenn Jackman on 16 Apr 2008 10:30
At 2008-04-16 10:15AM, "jaredsubman(a)yahoo.com" wrote: > I'd like to do is have the short hostname, of the title bar of my > putty window in the far upper left-hand corner, followed by the date > in the far upper right-hand corner. > > Currently, this is what I have in my .bashrc: > > export HOST=$(echo $HOSTNAME |cut -d"." -f1) > export DATE=$(date +%a" "%b" "%d) > export TERM=xterm > > printf "\033]0;$HOST%160s$DATE\007" > > (Also, why would this be 160 and not > 80???) That's up to you. The difficulty is the title bar does not use a monospace font (by default). Try: printf "\033]0;%-80s%s\007" "$HOST" "$DATE" and play with the first field width to taste -- Glenn Jackman "If there is anything the nonconformist hates worse than a conformist, it's another nonconformist who doesn't conform to the prevailing standard of nonconformity." -- Bill Vaughan |