Operating System - HP-UX
1846087 Members
4041 Online
110253 Solutions
New Discussion

Re: Lengthy string in script getting truncated

 
Vishal Biyani
Advisor

Lengthy string in script getting truncated

I am calling a java program from a shell script.One the arguments to this program is a lengthy string. If i pass directly like this:
/opt/java/bin/javac Program "|HEADER|JAR933|vishal.biyani@rediffmail.com|290001|OL0006528|WIN4015444|SHAFT_FORGING|1.0|Baan EDM|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|290001|WIN4015444|00||||2|SHAFT FORGING|9|AXELSMIDE|3|ACHSE SCHMIEDESTÜCK|4|ARBRE FORGÉ|f|AKSELITAOS|||||||||||||||||||||||No||Approved|41.0|Mechanic|Yes|pc||WIN4015444|EL20|Purchased|Metric||0|20051120|||||Released||||||||||||||||No||||||||||||||||||||||||||||||||
"
this works properly but if i assign this string to a variable (say data) and then pass the data variable as argument to program then it gets truncated like:
/opt/java/bin/javac Program $data

What is the problem and how to solve it?
Learning should never stop!
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: Lengthy string in script getting truncated

Shalom Vishal,

As far as I remember you can not transmit more than 256 characters in one command line argument. I recall hearing that this was a feature of the POSIX shell.

I think you are going to need to break this up into a few pieces none of which can be greater than 256 bytes.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vishal Biyani
Advisor

Re: Lengthy string in script getting truncated

Ok, now can you please tell me if i have a file in which this data of string is written and i want to pass this as an argument to java class through shell script, how do i do it?
Learning should never stop!
john korterman
Honored Contributor

Re: Lengthy string in script getting truncated

Hi,

please show us how you got
$data

Did you embed the variable in single quotes? That could explain why it is not expanded. If that is the case, try using double quotes ""



regards,
John K.
it would be nice if you always got a second chance