[SC.LUG] a simple script

Andrew Hutchings info at a-wing.co.uk
Thu Jan 26 07:14:39 GMT 2006


On Wednesday 25 January 2006 22:50, Simeon Farrington wrote:

> #!/bin/sh
>
> cat ~/mail/Inbox | grep "To: " > /tmp/chk
> CHK="To:"
> echo `cat /tmp/chk | cut -c 1-4 | tail -1` > /tmp/chk2
> if [ `cat /tmp/chk2`  == "" ]; then
> exit 0
> elif [ `cat /tmp/chk2`  = "$CHK" ]; then
> beep -f 400
> fi
>

for starers I can't remember if the 'if' lines are single equals or double in 
bash but try using eq instead.  The echo line might be simpler if you use 
`tail -n1 /tmp/chk2 | cut -c 1 4` > /tmp/chk2

Regards
Andrew

-- 
Andrew Hutchings (A-Wing) - Linux Guru
Linux CDs and DVDs - http://www.linuxiso.co.uk/
Linux quote 182/232: 'chmod a+x /bin/laden' allow anyone the permission to 
execute bin laden - Brad Brown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sc/attachments/20060126/5f48e9df/attachment.bin


More information about the SC mailing list