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

zoliky

macrumors newbie
Original poster
Jun 8, 2009
22
0
I want to open a file, and execute two terminal commands. How can I do this?
I need a "/bin/sh" string at the beginning of the file or something similar?
 
Depends quite what you want - something like this?

vim /Users/you/file.txt && rm -r / && echo "Hello World"

Just stick the commands like that in a file and chmod +x. You can then execute that from the command line.

If you want each process to finish before the next, just use a single & between each.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.