Passing the value of variable which is read from command line in called script

Hi,

I am calling a Perl script in my shell script. When Perl script is executed it asks for a answer to be entered by user from terminal. How can i pass that value from my shell script ??

I know I can change perl script to default the answer but i dont have access to do that so only option i have is to pass from the shell script somehow.

PLEASE HELP.

Thanks,
Varun Kumar

You can pass variables or constants when you call the perl script:

my_perl_script.pl $my_variable

But that doesn't mean the perl script is not going to continue to prompt for parameter, If the perl script is not first checking to see if parameter was supplied as argument on call then it's going to continue to prompt for parameter.

I dont think that will work here is how it works.

This is what my shell script is doing

  1. Checks if /var -gt 90 % then run the perl script which cleans up the file system. however when the perl script runs it asks for a answer do you wnat to continue so we have to answer 'Y'

I need to pass the value Y automatically so when it asks that Y is automatically passed.

Thanks

---------- Post updated 04-03-13 at 05:21 PM ---------- Previous update was 04-02-13 at 10:03 PM ----------

Any luck?

my_perl_script.pl <<EOF
Y
EOF

If you ever need an indeterminate number of affirmations, consult man yes .

Regards,
Alister

It did not work failed saying unexpected <<