Shell script to input as if from command line to the java program

Hi,

We are having a java server which can run on command line and once initiated, it will prompt options to enter from 0 to 5. The java program kickoff respective operation once number is entered between 0 to 5. However i want to always enter "1" and write another shell program wrapper to start this java program and provide "1" as input so that the server will perform respective operation.

can some one help me in this regard?

Thanks,
Surya

Need more details, could you please describe the steps you take?

Read up on "here-document". Basically:

java_command_you_want_to_feed_input_to <<EOF
1
EOF

The shell will feed the lines between the "EOF"s (can be any string, the ending string must be at the front of a line) to the command when it expects input.

Thanks Gary for the reply. However below solution did not work
java_command_you_want_to_feed_input_to <<EOF
1
EOF

Once shell script started releavant java command triggering and displaying options from 0-5 continuously in an infinite loop. I had stopped it forcefully with Ctrl-c

The shell script has below code:

export CLASSPATH=$CLASSPATH:ds.jar:./lib/antlr-2.7.6rc1.jar:./lib/cglib-2.1.3.jar:./lib/ehcache-1.2.3.jar:./lib/log4j-1.2.8.jar:./lib/asm-attrs.jar:.:
java com.infronics.smssol.main.DaemonStartUp ./res/daemon_config.cfg ./res/smpp_config_file.xml <<EOF
1
EOF

You'll need to study what the java program expects as input and put the appropriate responses in the here-document.