It's time to learn how to play poker for free on Casino770 if you feel like winning enough to take part in the biggest live tournaments in the world!
The Ashes
JavaScript on the command line or as a shell scripting language
I am always fascinated that no matter how shiny the OS, sooner or later you’ll end up typing things into a text console to get the darn machine to do what you want it to. To make matters worse you also have to resort to languages that you don’t use every day but are from cryptic days of development where keyboards obviously had more interesting characters like ~ | — and others easily available and scripts had to have numerous | in any line of code.
Enter Stoyan Stefanov who wrote a neat little blog post explaining how you can use JavaScript as a shell language.
In essence, Rhino is the answer for *nix machines but if you cuddle the penguin you most likely are a shell master anyways.
If your world features Gates and Windows, then there is the Windows Scripting Host, which has a tool to execute JavaScript on the DOS shell:
-
C:\> cscript jslint.js
Macs have a tool called JSC which is “conveniently” located in:
-
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc
To make it human usable, creating a shortcut is a good plan:
-
$ sudo ln /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /bin/jsc
You can then execute JavaScript by starting JSC which gives you something like the Firebug JS console in the OS console (without the console is not defined messages *in* the console).
With a few more lines using the print(), quit() and load() commands available on the shell you can then use any JavaScript to mess with your files and folders.
No Comments