Any way to start a program many times?

Discussion in 'Mac Basics and Help' started by yarjarrar, Sep 26, 2010.

  1. yarjarrar macrumors member

    Joined:
    Jul 2, 2008
    Location:
    California
    #1
    This is a ticklish question, but is there any way to open an application and close it, open it. so on, many times. So the application gets started like 100 times in a minute. Is that possible or am I nuts to think there's a way to do that?
     
  2. foidulus macrumors 6502a

    Joined:
    Jan 15, 2007
    #2
    Yeah, thats what terminal was made for!

    here is a quick script I just wrote that will open and then kill Safari 100 times

    Code:
    #!/bin/bash
    
    for I in {1..100}
    do
    
    /Applications/Safari.app/Contents/MacOS/Safari
    
    sleep 10
    
    killall Safari
    
    done
    
    
     
  3. xsimsimx macrumors member

    xsimsimx

    Joined:
    Sep 26, 2010
  4. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #4
    Code:
    #!/bin/bash
    
    for I in {1..100}
    do
            open /Applications/Safari.app
            sleep 3
            killall Safari
    done
    
     
  5. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #5
    You need an & at the end of your Safari invocation.
     
  6. xsimsimx macrumors member

    xsimsimx

    Joined:
    Sep 26, 2010
    #6
    What's the use of opening and close a app for so many times
     
  7. MacDawg macrumors P6

    MacDawg

    Joined:
    Mar 20, 2004
    Location:
    "Between the Hedges"
    #7
    It could be used to check performance I suppose... benchmarking, etc.
     

Share This Page