6 ms·
Yep, it's been there a while: rterrell$ /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc >>> for (var i=0; i<10; i++) { print("
by robterrell 9y ago
Yep, it's been there a while:
rterrell$ /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc
>>> for (var i=0; i<10; i++) { print("Hello World!", i); }
Hello World! 0
Hello World! 1
Hello World! 2
Hello World! 3
Hello World! 4
Hello World! 5
Hello World! 6
Hello World! 7
Hello World! 8
Hello World! 9
undefined
>>>
Edit to add: the submission reminds me of the old "Commando" for MPW. Very cool.
- lloeki 9y agoWell, while I did know JSC was a standalone thing (a framework, rather) on macOS, notably due to its presence in AppleScript Editor, I did not know it had a REPL readily available, and that the jsc interpreter works for shebangs too!
- robterrell 9y agoI found out about it when using Cappuccino -- on mac os x it would build much faster using jsc instead of narwhal. For about a week after that I tried writing shell scripts using the jsc shebang... but it ended up being a lot more painful than I imagined.