Xref: utzoo comp.windows.x:20203 comp.sources.wanted:11137 Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!warwick!rlnfs4!caag From: caag@inf.rl.ac.uk (Crispin Goswell) Newsgroups: comp.windows.x,comp.sources.wanted Subject: Re: Xfortune? Message-ID: <8900@nfs4.rl.ac.uk> Date: 26 Mar 90 14:52:53 GMT References: Reply-To: caag@inf.rl.ac.uk (Crispin Goswell) Organization: Rutherford Appleton Laboratory, Informatics Department, U.K. Lines: 45 In article jv@mh.nl (Johan Vromans) writes: >I'm looking for a X version of fortune(6). One that displays the >fortune message in a separate window, sized to the size of the >message. >Does there exist such a goodie? How about this five minute shell script? It could probably use some tidying up. Type RETURN in the window to make it go away. -------------------- cut here ---------------- #!/bin/sh if [ $# = 0 ] then TEMP=/tmp/xfortune$$ export TEMP /usr/games/fortune >$TEMP LINES=`wc -l <$TEMP` LINES=`echo $LINES` COLS=`awk -e '{ last = length ($0); if (widest < last) widest = last;} END{if (last == widest) print widest+1; else print widest;}' $TEMP` xterm -geom ${COLS}x${LINES} -e $0 $TEMP $LINES else head -"`expr $2 - 1`" $1 echo -n "`tail -1 $1`" rm $1 read foo fi ----------------------------------------------- Name: Crispin Goswell |-------|__ Informatics Department UUCP: {... | mcvax}!ukc!rlinf!caag | Tea | | Rutherford Appleton Lab JANET: caag@uk.ac.rl.inf \ Mug /_/ Chilton, Didcot ARPA: caag%inf.rl.ac.uk@nsfnet-relay.ac.uk \_____/ Oxon OX11 0QX, UK "Where are you when the Sun goes down? You're so far away from me." - Dire Straits -- Name: Crispin Goswell |-------|__ Informatics Department UUCP: {... | mcvax}!ukc!rlinf!caag | Tea | | Rutherford Appleton Lab JANET: caag@uk.ac.rl.inf \ Mug /_/ Chilton, Didcot ARPA: caag%inf.rl.ac.uk@nsfnet-relay.ac.uk \_____/ Oxon OX11 0QX, UK "Where are you when the Sun goes down? You're so far away from me." - Dire Straits