Jared L Cowan
Jared L Cowan

Reputation: 56

Custom command to create and open multiple files in terminal

I'm wondering if there is a way to create and open multiple files in terminal using a custom one-liner terminal command using OSX 10.9.4.

like $ makemore test.rb test2.rb

then it opens using my default Sublime Text3

I found the custom command to create and open a single file.

lazy()
{
touch $1
open $1
}

Is this possible to make something that makes, then opens multiple files?

P.S. Thanks to this Stackoverflow question for how to make custom command to create and open a single file. How can I create and open a file from terminal with a single command?

Upvotes: 0

Views: 797

Answers (1)

William Pursell
William Pursell

Reputation: 212248

lazy() { for x; do touch "$x"; open "$x"; done; }

Then call it with a list of file names.

Upvotes: 1

Related Questions