Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lukin

macrumors regular
Original poster
Jul 24, 2008
124
0
Hello, thanks for your help.

I want to run some terminal commands fairly often... yet I don't want to have to type them. I just switched from windows, so I need some help as to how to do this.

In windows I would've just used a batch file to run command prompt commands. I need something that will let me just run it and it will automatically run the commands.

Thanks.
 
Simple example. Create a text file named "junk.txt" that contains following:

#!/bin/bash
ls -ltr

Then type:

chmod 755 junk.txt (makes your file executable)

Then type:

./junk.txt

And you'll see a list of files in the current directory.
 
If you want the file to be double-clickable just use the previous poster's example but call it "junk.command" instead of "junk.txt". The finder will the recognize that it is a script and let the terminal handle it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.