How to find if a specific application exists at a given path

Discussion in 'Mac Programming' started by swimlikehell, Apr 11, 2008.

  1. macrumors member

    #1
    Hello,

    I am trying to find one of two things, either given a path find if a application exists at that path. Or If I can search an entire comp for an application and retrieve its path. If any one has any suggestions on either of these it would be much appreciated.
     
  2. macrumors 65816

    #2
    Using an sh shell script you can do something like:

    Code:
    #!/bin/sh
    
    if [ -f "/my/lost/app" ]
    then
        echo "found it! :)"
    else
        echo "didn't find it :("
    fi
    
    The if statement just tests to see if the file specified exists. You can also look at the find command. http://unixhelp.ed.ac.uk/CGI/man-cgi?find
     

Share This Page