How to launch an app in terminal with a command to do something?

Discussion in 'OS X Mavericks (10.9)' started by Woodcrest64, Nov 3, 2014.

  1. Woodcrest64 macrumors 65816

    Woodcrest64

    Joined:
    Aug 14, 2006
    #1
    What do I type in terminal to run an application followed by a command to do something with that app? I want to do this with a single command line.

    Like OPEN 'appication' ADB with the command 'reboot bootloader'
     
  2. pentool macrumors newbie

    Joined:
    Jul 20, 2013
    #2
    You can use the 'open' command. Type in 'man open' in the Terminal (without the single quotes) to get info about the 'open' command in general. It will also show examples towards the end of the help file.

    If it's something complicated you want to do, you might want to create an Apple Script to do whatever you want in the program, then use the Terminal 'open' command to open the script itself.
     
  3. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #3
    Not sure what's complicated about this. 'adb' is a command-line utility. Open the Terminal shell. Type:

    Code:
    adb reboot bootloader
    Assuming adb is in your path, it will work.
     
  4. Woodcrest64 thread starter macrumors 65816

    Woodcrest64

    Joined:
    Aug 14, 2006
    #4
    Solved!

    Thanks for the replies. I got my answer.

    I have to use the following command because adb isn't installed as a bash command if that makes any sense. If I don't use ./adb then I get an error message saying 'command not found'

    ./adb reboot bootloader

    The ' ./ ' is need assuming adb isn't correctly installed as a bash command I believe but the command MUST be used in the same directory as where the app installed.
     
  5. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #5
    No, you're not required to be in the same directory where the app is installed. Your issue is that the directory with the adb executable isn't in your shell's PATH variable. You have a couple options:

    1. Modify the PATH variable to include the directory where the adb executable is.
    2. Add an alias to adb.

    Given that you don't have a lot of experience using the shell, my guess is that option 2 is probably easier for you.

    Code:
    alias adb=/full/path/to/adb
    To find the full path, you can 'cd' to the directory where adb is and type 'pwd' which will give you the path to the directory.

    Then you can use the 'adb' command in whatever directory you are in. When you use './adb', you are fully specifying the path to the adb command. "./" means "the current directory".
     

Share This Page