send carriage return to java application from a shell
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a script that invoke a java/scala application, this application asks the user several inputs.
I want to automatically give the answers to the java app, so I'm creating this script. I have some trouble when it needs to give carriage return to the java application in some default cases.
Now, in this environment OS SunOS 5.10, bash, java, if I run this statement from command prompt it works fine:
printf "%sn" 1 1 3333333 $'r' N 80909090 800302 PSC000C0 33 16 COMPANY Y Y $'r' $'r' $'r' $'r' quit | simula.sh
But if I put the same statement within a shell script, it doesn't work
Match error. The value not match with: [A-Z,a-z,0-9,s]1,25
Match error. The value not match with: [A-Z0-9]3(:[^:]+)*
I presume because of regular expressions.
The same behavior if I enter from keyboard within a command prompt CTRL+V CTRL+M to simulate CR instead of $'r' and it works but doesn't when I put it within a script shell.
Any suggestion ?
shell scripting java escape-characters
add a comment |Â
up vote
0
down vote
favorite
I have a script that invoke a java/scala application, this application asks the user several inputs.
I want to automatically give the answers to the java app, so I'm creating this script. I have some trouble when it needs to give carriage return to the java application in some default cases.
Now, in this environment OS SunOS 5.10, bash, java, if I run this statement from command prompt it works fine:
printf "%sn" 1 1 3333333 $'r' N 80909090 800302 PSC000C0 33 16 COMPANY Y Y $'r' $'r' $'r' $'r' quit | simula.sh
But if I put the same statement within a shell script, it doesn't work
Match error. The value not match with: [A-Z,a-z,0-9,s]1,25
Match error. The value not match with: [A-Z0-9]3(:[^:]+)*
I presume because of regular expressions.
The same behavior if I enter from keyboard within a command prompt CTRL+V CTRL+M to simulate CR instead of $'r' and it works but doesn't when I put it within a script shell.
Any suggestion ?
shell scripting java escape-characters
Welcome to Unix Stackexchange! You can take the tour first and the learn How to Ask a good question. That makes it easier for us to help you.
â andcoz
Jun 27 at 12:08
1
Which shell are you using? Which software does print theMatch error
?
â andcoz
Jun 27 at 12:14
This question gives you a general clue on sending input from a shell script to an interactive program. In the questionfdisk
utility is used, but the principle seems to be the same.
â Tim
Jun 27 at 13:45
I'm using bash shell (/usr/bin/bash) on SunOS 5.10 Generic_Virtual sun4v sparc sun4v macchine, my script should be call another script calling java application: #!/bin/bash ROOT=/xx/xx/xx CP=$ROOT/scripts/lib/simula.jar:$ROOT/lib/ojdbc6.jar:$ROOT/scripts/lib/scala-library.jar:$ROOT/scripts/lib/xmlmessages.jar:$ROOT/lib/sp-util.jar:$ROOT/lib/protomatter-1.1.9.jar /opt/spr/root/java/bin/java -cp $CP xxxxx -conn jdbc:oracle:thin:@//lxxxxxxxxxxxxx $, java version "1.6.0_22", java appl prints Match error
â GiaCorsa
Jun 27 at 14:28
pls, can anyone help me?
â GiaCorsa
Jun 28 at 13:12
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a script that invoke a java/scala application, this application asks the user several inputs.
I want to automatically give the answers to the java app, so I'm creating this script. I have some trouble when it needs to give carriage return to the java application in some default cases.
Now, in this environment OS SunOS 5.10, bash, java, if I run this statement from command prompt it works fine:
printf "%sn" 1 1 3333333 $'r' N 80909090 800302 PSC000C0 33 16 COMPANY Y Y $'r' $'r' $'r' $'r' quit | simula.sh
But if I put the same statement within a shell script, it doesn't work
Match error. The value not match with: [A-Z,a-z,0-9,s]1,25
Match error. The value not match with: [A-Z0-9]3(:[^:]+)*
I presume because of regular expressions.
The same behavior if I enter from keyboard within a command prompt CTRL+V CTRL+M to simulate CR instead of $'r' and it works but doesn't when I put it within a script shell.
Any suggestion ?
shell scripting java escape-characters
I have a script that invoke a java/scala application, this application asks the user several inputs.
I want to automatically give the answers to the java app, so I'm creating this script. I have some trouble when it needs to give carriage return to the java application in some default cases.
Now, in this environment OS SunOS 5.10, bash, java, if I run this statement from command prompt it works fine:
printf "%sn" 1 1 3333333 $'r' N 80909090 800302 PSC000C0 33 16 COMPANY Y Y $'r' $'r' $'r' $'r' quit | simula.sh
But if I put the same statement within a shell script, it doesn't work
Match error. The value not match with: [A-Z,a-z,0-9,s]1,25
Match error. The value not match with: [A-Z0-9]3(:[^:]+)*
I presume because of regular expressions.
The same behavior if I enter from keyboard within a command prompt CTRL+V CTRL+M to simulate CR instead of $'r' and it works but doesn't when I put it within a script shell.
Any suggestion ?
shell scripting java escape-characters
edited Jun 27 at 15:24
Tim
463211
463211
asked Jun 27 at 12:05
GiaCorsa
1
1
Welcome to Unix Stackexchange! You can take the tour first and the learn How to Ask a good question. That makes it easier for us to help you.
â andcoz
Jun 27 at 12:08
1
Which shell are you using? Which software does print theMatch error
?
â andcoz
Jun 27 at 12:14
This question gives you a general clue on sending input from a shell script to an interactive program. In the questionfdisk
utility is used, but the principle seems to be the same.
â Tim
Jun 27 at 13:45
I'm using bash shell (/usr/bin/bash) on SunOS 5.10 Generic_Virtual sun4v sparc sun4v macchine, my script should be call another script calling java application: #!/bin/bash ROOT=/xx/xx/xx CP=$ROOT/scripts/lib/simula.jar:$ROOT/lib/ojdbc6.jar:$ROOT/scripts/lib/scala-library.jar:$ROOT/scripts/lib/xmlmessages.jar:$ROOT/lib/sp-util.jar:$ROOT/lib/protomatter-1.1.9.jar /opt/spr/root/java/bin/java -cp $CP xxxxx -conn jdbc:oracle:thin:@//lxxxxxxxxxxxxx $, java version "1.6.0_22", java appl prints Match error
â GiaCorsa
Jun 27 at 14:28
pls, can anyone help me?
â GiaCorsa
Jun 28 at 13:12
add a comment |Â
Welcome to Unix Stackexchange! You can take the tour first and the learn How to Ask a good question. That makes it easier for us to help you.
â andcoz
Jun 27 at 12:08
1
Which shell are you using? Which software does print theMatch error
?
â andcoz
Jun 27 at 12:14
This question gives you a general clue on sending input from a shell script to an interactive program. In the questionfdisk
utility is used, but the principle seems to be the same.
â Tim
Jun 27 at 13:45
I'm using bash shell (/usr/bin/bash) on SunOS 5.10 Generic_Virtual sun4v sparc sun4v macchine, my script should be call another script calling java application: #!/bin/bash ROOT=/xx/xx/xx CP=$ROOT/scripts/lib/simula.jar:$ROOT/lib/ojdbc6.jar:$ROOT/scripts/lib/scala-library.jar:$ROOT/scripts/lib/xmlmessages.jar:$ROOT/lib/sp-util.jar:$ROOT/lib/protomatter-1.1.9.jar /opt/spr/root/java/bin/java -cp $CP xxxxx -conn jdbc:oracle:thin:@//lxxxxxxxxxxxxx $, java version "1.6.0_22", java appl prints Match error
â GiaCorsa
Jun 27 at 14:28
pls, can anyone help me?
â GiaCorsa
Jun 28 at 13:12
Welcome to Unix Stackexchange! You can take the tour first and the learn How to Ask a good question. That makes it easier for us to help you.
â andcoz
Jun 27 at 12:08
Welcome to Unix Stackexchange! You can take the tour first and the learn How to Ask a good question. That makes it easier for us to help you.
â andcoz
Jun 27 at 12:08
1
1
Which shell are you using? Which software does print the
Match error
?â andcoz
Jun 27 at 12:14
Which shell are you using? Which software does print the
Match error
?â andcoz
Jun 27 at 12:14
This question gives you a general clue on sending input from a shell script to an interactive program. In the question
fdisk
utility is used, but the principle seems to be the same.â Tim
Jun 27 at 13:45
This question gives you a general clue on sending input from a shell script to an interactive program. In the question
fdisk
utility is used, but the principle seems to be the same.â Tim
Jun 27 at 13:45
I'm using bash shell (/usr/bin/bash) on SunOS 5.10 Generic_Virtual sun4v sparc sun4v macchine, my script should be call another script calling java application: #!/bin/bash ROOT=/xx/xx/xx CP=$ROOT/scripts/lib/simula.jar:$ROOT/lib/ojdbc6.jar:$ROOT/scripts/lib/scala-library.jar:$ROOT/scripts/lib/xmlmessages.jar:$ROOT/lib/sp-util.jar:$ROOT/lib/protomatter-1.1.9.jar /opt/spr/root/java/bin/java -cp $CP xxxxx -conn jdbc:oracle:thin:@//lxxxxxxxxxxxxx $, java version "1.6.0_22", java appl prints Match error
â GiaCorsa
Jun 27 at 14:28
I'm using bash shell (/usr/bin/bash) on SunOS 5.10 Generic_Virtual sun4v sparc sun4v macchine, my script should be call another script calling java application: #!/bin/bash ROOT=/xx/xx/xx CP=$ROOT/scripts/lib/simula.jar:$ROOT/lib/ojdbc6.jar:$ROOT/scripts/lib/scala-library.jar:$ROOT/scripts/lib/xmlmessages.jar:$ROOT/lib/sp-util.jar:$ROOT/lib/protomatter-1.1.9.jar /opt/spr/root/java/bin/java -cp $CP xxxxx -conn jdbc:oracle:thin:@//lxxxxxxxxxxxxx $, java version "1.6.0_22", java appl prints Match error
â GiaCorsa
Jun 27 at 14:28
pls, can anyone help me?
â GiaCorsa
Jun 28 at 13:12
pls, can anyone help me?
â GiaCorsa
Jun 28 at 13:12
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f452206%2fsend-carriage-return-to-java-application-from-a-shell%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Welcome to Unix Stackexchange! You can take the tour first and the learn How to Ask a good question. That makes it easier for us to help you.
â andcoz
Jun 27 at 12:08
1
Which shell are you using? Which software does print the
Match error
?â andcoz
Jun 27 at 12:14
This question gives you a general clue on sending input from a shell script to an interactive program. In the question
fdisk
utility is used, but the principle seems to be the same.â Tim
Jun 27 at 13:45
I'm using bash shell (/usr/bin/bash) on SunOS 5.10 Generic_Virtual sun4v sparc sun4v macchine, my script should be call another script calling java application: #!/bin/bash ROOT=/xx/xx/xx CP=$ROOT/scripts/lib/simula.jar:$ROOT/lib/ojdbc6.jar:$ROOT/scripts/lib/scala-library.jar:$ROOT/scripts/lib/xmlmessages.jar:$ROOT/lib/sp-util.jar:$ROOT/lib/protomatter-1.1.9.jar /opt/spr/root/java/bin/java -cp $CP xxxxx -conn jdbc:oracle:thin:@//lxxxxxxxxxxxxx $, java version "1.6.0_22", java appl prints Match error
â GiaCorsa
Jun 27 at 14:28
pls, can anyone help me?
â GiaCorsa
Jun 28 at 13:12