Hi
I want to write a script file that first executes a command

/usr/sbin/alternatives --config java

which asks to enter a number.... i want to give this input automatically by the script... i dont want human intervention....how can i do this.....

Hey There,

It depends on how /usr/sbin/alernatives takes input, but two possible solutions would be

echo input|/usr/sbin/alternatives...etc

or

/usr/sbin/alternatives arg arg <input

Basically, you'll have to redirect output to be the commands input. If this is a custom script you might need to add functionality to it so that it will accept arguments from STDIN.

Best wishes,

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.