PDA

View Full Version : .command files




Muncher
Nov 29, 2007, 10:52 PM
Simply put, what the hell are .command files? I've only seen them once (http://pouet.net/prod.php?which=30152).

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?



mac-convert
Nov 29, 2007, 10:55 PM
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.

Muncher
Nov 29, 2007, 11:07 PM
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.

mac-convert
Nov 29, 2007, 11:08 PM
No thanks - anyone else?

Edit: maybe someone on that site can assist you

Gelfin
Nov 29, 2007, 11:17 PM
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.

Krevnik
Nov 30, 2007, 01:54 AM
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.

pilotError
Nov 30, 2007, 07:21 AM
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.

Krevnik
Nov 30, 2007, 10:50 AM
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.

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.

telecomm
Nov 30, 2007, 04:52 PM
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.