Pocitadlo


To CZ-debian list <czdebian-l zavinac debian bod cz>
From Matej Cepl <matej zavinac ceplovi bod cz>
Date Sat, 9 Nov 2002 10:11:55 -0500
Mail-followup-to CZ-debian list <czdebian-l zavinac debian bod cz>
Organization Northeastern University
User-agent Mutt/1.3.28i

Dobrý den,

vytvořil jsem tento skriptík a moc se mi nelíbí.

        #!/bin/sh
        function countout () {
                if [ $(( $1 % 5)) = 0 ]; then FIVE=1 ; else FIVE=0 ; fi
                if [ $2 == 's' ]; then SPAM=1 ; else SPAM=0 ; fi
                if [ $SPAM -eq 1 ] && [ $FIVE -eq 1 ]; then echo -n '*' ; fi
                if [ $SPAM -eq 1 ] && [ $FIVE -eq 0 ]; then echo -n '+' ; fi
                if [ $SPAM -eq 0 ] && [ $FIVE -eq 1 ]; then echo -n '-' ; fi
                if [ $SPAM -eq 0 ] && [ $FIVE -eq 0 ]; then echo -n '.' ; fi
        }

        for i in 1 2 3 4 5 6 7 8 9 10 11 12 13
        do
                countout $i 'n'
        done

Bohužel ani přes veškerou snahu (a studování bash(1)) se mi
nepodařilo funkci countout napsat nějak kulturněji (zkoušel jsem
vnořené if ... then a podmíněné výrazy, ale ani jedno mi
nefungovalo). Poradíte někdo, prosím?

        Děkuji

                Matěj

-- 
Matej Cepl, matej zavinac ceplovi bod cz, PGP ID# D96484AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
We are told that [St. Anthony] once fell into dejection, finding
uninterrupted contemplation above his strength; but was taught to
apply himself at intervals to manual labour by a vision of an
angel who appeared platting mats of palm-tree leaves, then rising
to pray, and after some time sitting down again to work; and who
at length said to him, "Do thus, and thou shalt be saved."
    -- Life of St. Anthony


Partial thread listing: