安装 sdkman
$curl -s "https://get.sdkman.io" | bash
-+syyyyyyys:
`/yho:` -yd.
`/yh/` +m.
.oho. hy .`
.sh/` :N` `-/o` `+dyyo:.
.yh:` `M- `-/osysoym :hs` `-+sys: hhyssssssssy+
.sh:` `N: ms/-`` yy.yh- -hy. `.N-````````+N.
`od/` `N- -/oM- ddd+` `sd: hNNm -N:
:do` .M. dMMM- `ms. /d+` `NMMs `do
.yy- :N` ```mMMM. - -hy. /MMM: yh
`+d+` `:/oo/` `-/osyh/ossssssdNMM` .sh: yMMN` /m.
-dh- :ymNMMMMy `-/shmNm-`:N/-.`` `.sN /N- `NMMy .m/
`oNs` -hysosmMMMMydmNmds+-.:ohm : sd` :MMM/ yy
.hN+ /d: -MMMmhs/-.` .MMMh .ss+- `yy` sMMN` :N.
:mN/ `N/ `o/-` :MMMo +MMMN- .` `ds mMMh do
/NN/ `N+....--:/+oooosooo+:sMMM: hMMMM: `my .m+ -MMM+ :N.
/NMo -+ooooo+/:-....`...:+hNMN. `NMMMd` .MM/ -m: oMMN. hs
-NMd` :mm -MMMm- .s/ -MMm. /m- mMMd -N.
`mMM/ .- /MMh. -dMo -MMMy od. .MMMs..---yh
+MMM. sNo`.sNMM+ :MMMM/ sh`+MMMNmNm+++-
mMMM- /--ohmMMM+ :MMMMm. `hyymmmdddo
MMMMh. ```` `-+yy/`yMMM/ :MMMMMy -sm:.``..-:-.`
dMMMMmo-.``````..-:/osyhddddho. `+shdh+. hMMM: :MmMMMM/ ./yy/` `:sys+/+sh/
.dMMMMMMmdddddmmNMMMNNNNNMMMMMs sNdo- dMMM- `-/yd/MMMMm-:sy+. :hs- /N`
`/ymNNNNNNNmmdys+/::----/dMMm: +m- mMMM+ohmo/.` sMMMMdo- .om: `sh
`.-----+/.` `.-+hh/` `od. NMMNmds/ `mmy:` +mMy `:yy.
/moyso+//+ossso:. .yy` `dy+:` .. :MMMN+---/oys:
/+m: `.-:::-` /d+ +MMMMMMMNh:`
+MN/ -yh. `+hddhy+.
/MM+ .sh:
:NMo -sh/
-NMs `/yy:
.NMy `:sh+.
`mMm` ./yds-
`dMMMmyo:-.````.-:oymNy:`
+NMMMMMMMMMMMMMMMMms:`
-+shmNMMMNmdy+:`
Now attempting installation...
Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Download script archive...
#=#=#
-=O=- # # # #
Installation
To use kscript just Kotlin and Maven are required. To install Kotlin we recommend sdkman:
curl -s "https://get.sdkman.io" | bash # install sdkman
source ~/.bash_profile # add sdkman to PATH
sdk install kotlin # install Kotlin
Once Kotlin is ready, you can install kscript with
sdk install kscript
To test your installation simply run
kscript --help
This will check and inform about udpates. To update kscript simply install it again as described above.
Interpreter Usage
To use kscript as interpreter for a script just point to it in the shebang line of your Kotlin scripts:
#!/usr/bin/env kscript
println("Hello from Kotlin!")
for (arg in args) {
println("arg: $arg")
}