From 895b9228d3d2f7bf7ec7b950e8d03f446bbbf043 Mon Sep 17 00:00:00 2001 From: Amir Karimi Date: Mon, 7 Dec 2015 14:54:43 +0330 Subject: [PATCH] Run script from bash --- scala/fucking-coffee.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scala/fucking-coffee.scala b/scala/fucking-coffee.scala index 20432bc..b40d083 100644 --- a/scala/fucking-coffee.scala +++ b/scala/fucking-coffee.scala @@ -1,17 +1,18 @@ /******************************************* * - * Get and run Ammonite (http://lihaoyi.github.io/Ammonite/#Ammonite-Shell): + * Get Ammonite (http://lihaoyi.github.io/Ammonite/#Ammonite-Shell): * $ mkdir ~/.ammonite; curl -L -o ~/.ammonite/predef.scala http://git.io/vR04f - * $ curl -L -o amm http://git.io/vR08A; chmod +x amm; ./amm + * $ curl -L -o amm http://git.io/vR08A; chmod +x amm * - * Run script: - * @ load.exec("fucking-coffee.scala") + * Run script + * $ ./amm fucking-coffee.scala * *******************************************/ import java.net._ import java.io._ import ammonite.ops._ +import ammonite.ops.ImplicitWd._ val coffeeMachineIP = "10.10.42.42" val password = "1234" @@ -25,6 +26,7 @@ if ((%%who "-q").out.string.contains(sys.props("user.name"))) { val out = new PrintWriter(telnet.getOutputStream, true) val in = new BufferedReader(new InputStreamReader(telnet.getInputStream)) + println(s"Wait for $delayBeforeBrew seconds") Thread.sleep(delayBeforeBrew * 1000); if(in.readLine == passwordPrompt){