Re: energy data in ksh prompts

2009-03-07 Thread Lars Noodén
Denis Doroshenko wrote:
> er, there is a \D{format} for that, see ksh(1)

Yes, there's a lot there.  date(1) was just the first, short way of
testing that the output changes, much nicer than
 tail -n 1 /var/something...

> backslashed special char for sensors, like \S{name} would be neat
> thing, though :-)

That would be quite cool.

Just for fun I am looking at ksh.  \D{format} seems to start on line in
/usr/src/bin/ksh/lex.c  and I expect that /usr/src/sys/sys/sysctl.h
would be used.  However, that's the extent of my C.

-Lars



Re: energy data in ksh prompts

2009-03-07 Thread Denis Doroshenko
On Sat, Mar 7, 2009 at 2:47 PM, Lars NoodC)n 
wrote:
> Here are two variations of the standard ksh shell prompt that I myself
> find useful on several of my devices, in particular the portables. B The
> first prompt shows the temperature on cpu0, the second the amount of
> battery claimed to remain:
>
> B  B  B  B export PS1='`( /sbin/sysctl hw.sensors.cpu0.temp0 | sed -e \
> B  B  B  B "s/^.*\([0-9][0-9]\.[0-9]\)\([0-9]\).*$/\1/g;")`$ '
> B  B  B  B 66.0$
>
> B  B  B  B export PS1='`/usr/sbin/apm -l`% $ '
> B  B  B  B 96% $
>
> Here is a test using date:
>
> B  B  B  B export PS1='`/bin/date +"%H:%M:%S"`$ '
> B  B  B  B 14:20:33$

er, there is a \D{format} for that, see ksh(1)
backslashed special char for sensors, like \S{name} would be neat
thing, though :-)



energy data in ksh prompts

2009-03-07 Thread Lars Noodén
Here are two variations of the standard ksh shell prompt that I myself
find useful on several of my devices, in particular the portables.  The
first prompt shows the temperature on cpu0, the second the amount of
battery claimed to remain:

export PS1='`( /sbin/sysctl hw.sensors.cpu0.temp0 | sed -e \
"s/^.*\([0-9][0-9]\.[0-9]\)\([0-9]\).*$/\1/g;")`$ '
66.0$

export PS1='`/usr/sbin/apm -l`% $ '
96% $

Here is a test using date:

export PS1='`/bin/date +"%H:%M:%S"`$ '
14:20:33$

apm is to cool running mode in rc.local

Regards
-Lars