not quite random
nothing in particular

 


January 2003
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Dec   Feb










Subscribe to "not quite random" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

jenett.radio.randomizer - click to visit a random Radio weblog - for information, contact randomizer@coolstop.com

Blogchalk:
Portsmouth, NH, US




 

Saturday, January 04, 2003

bash function to repeat a command

There may be a builtin to do this, but here is a function you can stick in your .bashrc. Usage: repeat N COMMAND COMMAND-ARGS. This will run COMMAND with COMMAND-ARGS, N times. Note that the quoting might be messy. I find this handy for running simple test scripts in a loop.

function repeat()
{
    count=$1
    shift
    if [ x$count = x ]
    then
        count=10
    fi

n=0 while [ $n != $count ] do eval $* n=`expr $n + 1` done }

12:14:03 PM   #  


Click here to visit the Radio UserLand website. © Copyright 2003 Brian St. Pierre.
Last update: 1/14/2003; 9:09:03 AM.