Launching a C program that needs input from a shell script

hi there,
i need some help, i am trying to run a script to launch a C program and a Java program but before running both I want to get a user input and then invoke both programs with input received. In the programs the inputs are not command line arguments.

This is the code,
after the java bof and the ./bof.out how can I pass my $UserInput argument to both programs? And save the output from the 2 programs into two new arguments?

#!/bin/bash
#
#
clear
echo "Please enter a file name:"
read UserInput
echo "$UserInput"

java bof
./bof

Help is appreciated.

#!/bin/bash
clear
echo "Please enter a file name:"
read UserInput
echo "$UserInput"

java bof $UserInput
./bof $UserInput

tyler_durden

thanks tyler but both programs don't accept command line arguments. in a normal scenario you will run the program by typing

./bof.out
then you will be asked to input something, where I want to input the $UserInput

i tried this but it didn't work:

./bof.out <<$UserInput

any suggestions?

Then change the programs so that they process arguments passed to them rather than prompting for them.

tyler_durden

isn't there another way to plug the arguments instead of passing them within the command line? if i change it to what you're suggesting then i'll loose the purpose coz I need to have a buffer over flow vulnerability there!