I have a Java program that I run in a Linux environment through a bash script.
This is my simple bash script that takes a string.
#!/bin/bash java -cp com.QuoteTester $1
The problem is that the command line argument can be with spaces or without spaces.
For example, it could be:
Apple Inc. 2013 Jul 05 395.00 Call
OR
Apple
My code is:
public static void main(String[] args) { String symbol = args[0]; if (symbol.trim().contains(" "))
So the problem is that when I try to execute it as follows:
./quotetester Apple Inc. 2013 Jul 05 395.00 Call
its only thing always happens in an else condition which is a margin.
Can I solve this problem?
Kiran source share