zero-trip foreach loops

David I. Berg dberg at cod.UUCP
Wed Oct 22 08:07:47 AEST 1986


In article <2494 at utai.UUCP>, lamy at utai.UUCP (Jean-Francois Lamy) writes:
> 
> Is there an easy way to have csh foreach loops that don't complain if the
> pattern given does not match any file...., 
> 

You might try:

touch dummy.tfm
foreach font (*.tfm)
    if $font = "dummy.dfm" continue
    set fontname = `basename $font .tfm`
    foreach size ($fontname.*pxl)
    ...
    end
end
rm dummy.tfm

-- 

David I. Berg (dberg)
Advanced Technology, Inc.
San Diego, CA

MILNET: dberg at nosc
UUCP:   {ihnp4 akgua decvax dcdwest ucbvax}!sdcsvax!noscvax!dberg



More information about the Comp.unix mailing list