I often write custom deploy scripts for the projects I work on. In most cases, I choose python. You can do pretty much everything with shell and system commands, but python dictionaries and lists make it very easy to manipulate data, lists of files, text, etc. Networking is also very easy in python (http, ftp, etc).
To run a Javascript file from the console you can type “node myscript.js”. Or you can set the application that will run the file like you do with bash or python:
-
#! /usr/bin/env node
-
-
console.log("Hello");
-
setTimeout(function() {
-
console.log("world!");
-
}, 2000);
Now you can change the permissions of the script to make it executable:
-
$ chmod 755 myscript.js
And run the script by typing its name, like you do with shell or python scripts:
-
$ ./myscript.js param1 param2 "param 3"
-
Hello
-
world!
Nice, uh? Now go and write some cool command line scripts in Javascript :)
