Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!leafusa!kmc From: kmc@leafusa.hq.ileaf.com (Keith Corbett) Newsgroups: comp.unix.questions Subject: Re: Highlighted output from shell script? Summary: why I love U**x, it's so gosh-darn portable sometimes Message-ID: <1990Feb1.233426.13095@leafusa.hq.ileaf.com> Date: 1 Feb 90 23:34:26 GMT Reply-To: kmc@ileaf.com Distribution: usa Organization: Interleaf, Inc. Lines: 57 I was intrigued by Michael Hammel's example of a script that highlights and blinks output (from <5276@dell.dell.com>), enough to try to get it to work, and guess what. Michael has Dell (Sys5?), so somebody else may need to take a whack at this for me (I'm running on a Sun). (It's a 3/50, "running" is a relative term.) (I don't code with sh at all, forgive me if this is all obvious to everyone -- this is c.u.??, right?) Some fixes were obvious, to make it work more generally, i.e., on a Sun, like using the Sys5 echo. =^} ... But the script still doesn't quite work. The Sun version of date doesn't include the '%B' format; what is that supposed to be generate??? For that matter, how are you supposed to get the full 4-char year?? Note that when I run this, I get a highlighted year, but no blinking date... ? --------------------------------------------------------- #!/bin/sh PATH=/usr/5bin:/usr/bin:/bin export PATH tmp=month$$ tmp2=newmonth$$ tod=`date +%m` tod2=`date +%y` cal $tod $tod2 | sed '/^$/d' > $tmp sed 's/^/ /' $tmp > $tmp2 #obviously wrong: fix me please! tod=`date +%d` sed 's/'$tod'/'`echo "\033[7m$tod\033[0m"`'/' $tmp2 > $tmp tod=`date +%y` sed 's/'$tod'/'`echo "\033[7m$tod\033[0m"`'/' $tmp > $tmp2 sed 's/^/'`echo "\033[36m"`'/' $tmp2 > $tmp tod=`date +%d` sed 's/ '$tod' / '`echo "\033[5;33m$tod\033[0;36m"`' /' $tmp > $tmp2 echo "\033[0m" >> $tmp2 cat $tmp2 rm $tmp $tmp2 --------------------------------------------------------- (Also, scripts shouldn't try to write files into the working directory, with all the read-only file-systems one is likely to be working in =-} - -- -- Keith Corbett 617-621-0555 x1727 Cambridge, MA, USA UUnet: uunet!leafusa!kmc via Internet: leafusa!kmc@uunet.uu.net Uucp: mit-eddie!ileaf!kmc via Internet: kmc@ileaf.com Book recommendation: "Foucault's Pendulum", Umberto Eco