jssh(javascript shell) is a command which can run javascript in shell. This is very usefull sometimes. Like you are newer to javascript, you can directly run javascript sample in shell.
This tool depend on java. So you need install java first.
- goto http://www.oracle.com/technetwork/java/javase/downloads/index.html
- download sdk
- Online
curl https://raw.githubusercontent.com/smallmuou/jssh/master/online-install.sh|sudo /bin/bash source ~/.bash_profile
- Manual
git clone https://github.com/smallmuou/jssh cd jssh sudo bash setup.sh install
sudo bash setup.sh uninstall
the sample.js like follow.
print("Hello jssh"); print("arg0 = " + $0); print("arg1 = " + $1); print("arg2 = " + $2); print("arg length = " + $n);
and run follow command:
jssh sample.js 123 345
and the output is:
Hello jssh arg0 = sample.js arg1 = 123 arg2 = 345 arg length = 3
- Comment
- arg must be less than 9.
- $0 - the name of js file
- $1 - arg1
- $2 - arg2
- $3 - arg3
- $4 - arg4
- $5 - arg5
- $6 - arg6
- $7 - arg7
- $8 - arg8
- $9 - arg9
- $n - arg length
- 1.1.0
- Support argument
- 1.0.0
- Support run javascript in shell
- Support Linux and Darwin
This tool follows MIT License.