Reputation: 2409
Let's say I have a few directories, each running a different branch of a Meteor development server. I could cd
to each directory, run meteor shell
, and type a command. And that's great for 2 or 3 directories, but what if I have 10? 100?
Is there some equivalent of
meteor shell < 'DoJSThing()`
that I can script from the command line, so that I can use[1]
for d in ./*/ ; do (cd "$d" && meteor shell "doJSThing()" ); done
Upvotes: 1
Views: 405
Reputation: 2409
On the latest Meteor (I'm currently testing on 1.3), you can indeed use the syntax provided in that pull request:
$ echo Meteor.isServer | meteor shell
true
You can also write your JS to a file and use the <
syntax to pipe into stdin:
$ meteor shell < myfile
It's worth noting that if you name your JS file with a .js extension, it'll auto-load into the running Meteor app, which is potentially, but probably not, what you want.
Upvotes: 3