Parse Command Line Arguments
Node.js:
Variable: process.argv
$ node argv.js 1 2 3
[ '/path/to/node', '/path/to/argv.js', '1', '2', '3' ]
Also: parseArgs
from node:util
Python
Variable: sys.argv
(must import sys
module)
$ python argv.py 1 2 3
['argv.py', '1', '2', '3']
Java
Variable: args
(String[]
datatype parameter in main()
function)
$ java Main 1 2 3
Contents of String[] args: ["1", "2", "3"]
C/C++
Variable: argv
(length is argc
)
int main(int argc, char * argv[]) {}
// also: char **argv