Monday, February 5, 2018

Reading exclamation mark (!) from command line on windows for scala script

Hi,
I was wondering while I was able to send the ! character as part command line argument to scala script on Linux shell but not on Windows.

Here is my Scala Script in Hello.scala file

object Hello extends App{
args.foreach( println(_))
}


Execution command from the command prompt on linux is

$scala  Hello.scala  This is my input!

Expected out is coming fine with ! mark, however the same thing on Windows machine the ! mark is not coming.  Here is the reason the windows shall take the input characters with escaped ^ and the command needs to be with in the string.  So the below command will come fine on the windows.

C:\>scala  Hello.scala  This is my "input^!"


====================== ENJOY LEARNING ==================