.command files

Discussion in 'Mac Programming' started by Muncher, Nov 29, 2007.

  1. macrumors 65816

    Muncher

    Joined:
    Apr 19, 2007
    Location:
    California
    #1
    Simply put, what the hell are .command files? I've only seen them once.

    They are binary executable files. Finder says they're associated with terminal. When I looked for them online, I got nothing. Does anyone know what these are?
     
  2. macrumors 6502a

    mac-convert

    Joined:
    Nov 2, 2006
    Location:
    Are we there yet?
    #2
    What in particular are you looking for?

    I check the web site, but I don't recognize it and I don't care to run the video there.
     
  3. thread starter macrumors 65816

    Muncher

    Joined:
    Apr 19, 2007
    Location:
    California
    #3
    You don't have to run the video, just download it. It's 4k - seriously, dude! It won't take a minute even on dial up. :rolleyes:

    I just want to know: a) what kind of file it is, and b) how to make one myself. I can find out the second part, I just need part a first.
     
  4. macrumors 6502a

    mac-convert

    Joined:
    Nov 2, 2006
    Location:
    Are we there yet?
    #4
    No thanks - anyone else?

    Edit: maybe someone on that site can assist you
     
  5. macrumors 68020

    Gelfin

    Joined:
    Sep 18, 2001
    Location:
    San Francisco, CA
    #5
    Pretty sure that's just an explicit way of associating a shell script with Terminal.app in the Finder. If you look at the contents of that file, you'll see that although the majority of it is a binary application, the first six lines are a shell script that extracts that binary content to a file in /tmp, runs it and then deletes it.

    Not that I'm going to run it. Video was coolish, I guess.
     
  6. macrumors 68020

    Krevnik

    Joined:
    Sep 8, 2003
    #6
    Yup, .command is meant to be used as shell scripts/etc for the Terminal. You can actually make unix binaries into .command files and it should run just fine.
     
  7. macrumors 68020

    pilotError

    Joined:
    Apr 12, 2006
    Location:
    Long Island
    #7
    The period at the beginning of the file name just makes it a hidden file to normal terminal directory listings. Probably in Finder as well.
     
  8. macrumors 68020

    Krevnik

    Joined:
    Sep 8, 2003
    #8
    The files don't start with period, it is a file extension. The files in quesion would be like:

    MyScript.command

    The .command file could be a bash script, a perl script, an executable file, pretty much anything you can correctly execute using the exec command or calling it directly.
     
  9. macrumors 65816

    telecomm

    Joined:
    Nov 30, 2003
    Location:
    Rome
    #9
    Funny, I was just talking about .command files with someone at work today. I use them all the time when working on projects that require several files. You can write a .command file that, say, opens up the terminal, launches three documents and two apps, then closes the terminal, all activated just by double clicking on an icon.
     

Share This Page