Xref: utzoo comp.unix.questions:17945 comp.unix.xenix:8687 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rpi!tale From: tale@pawl.rpi.edu (David C Lawrence) Newsgroups: comp.unix.questions,comp.unix.xenix Subject: Re: Supress Error Message Message-ID: <256C6EAA.736E@rpi.edu> Date: 23 Nov 89 22:26:49 GMT References: <52@fleet.UUCP> Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 61 In <52@fleet.UUCP> mel@fleet.UUCP (mel) writes: Mel> #! /bin/csh Mel> foreach i (rex cbay) Mel> foreach j (/usr/spool/uucp/$i/C.$i*) Mel> if (-e $j) then Mel> /usr/lib/uucp/uucico -r1 -s$i Mel> endif Mel> break Mel> end Mel> end Mel> The above script is triggered by the following line in my root cron file. Mel> 0,15,30,45 * * * * csh /usr/lib/uucp/uucall >/dev/null Why are you doing it this way? Does your XENIX not understand #! execution? If it does you shouldn't need the "csh". Mel> foreach: No match. Yeah. C Shell globbing does that to you. Mel> HOW CAN I ALTER THIS SCRIPT TO AVOID THE SENDING OF THIS MESSAGE FOR BOTH Mel> OF THE TWO CASES STATED ABOVE? A FEW DIFFERENT WAYS. Oops, looks like the ol' caps lock got stuck. You could rewrite it in sh; pretty trivial for this. In fact, just change everything to the equivalent Bourne shell syntax and your problem goes away: #! /bin/sh for i in rex cbay; do for j in /usr/spool/uucp/$i/C.$i*; do if [ -s $j ]; then # okay, okay. not really same as -e /usr/lib/uucp/uucico -r1 -s$i break 2 # okay, so i moved the break too. Why was a foreach even used? fi done done But that's more a political statement against csh than anything else, so just "set nonomatch" at the head of your csh script and the same sort of processing would occur. If you want to just bag any error messages that ever might happen, you could redirect stderr from the cron invocation, too. You could also use find(1) to avoid globbing complaints; take out the foreach j and replace it with: if [ "`find /usr/spool/uucp/$i -name \"C.$i*\" -print`" ]; then uucico ... fi There are probably at least four or five other ways to work this out, including a perl solution from Randall, soon to be appearing in a comp.unix.* group near you. Dave -- (setq mail '("tale@pawl.rpi.edu" "tale@ai.mit.edu" "tale@rpitsmts.bitnet"))