简体   繁体   中英

Simulating Enter in Bash Script on CentOS 6 Minimal

Right now I am using:

echo -ne '\n' | alternatives --config java

For

Enter to keep the current selection, or type selection number:

I know there are probably many ways to do this. I am looking for the correct way to perform this action. I honestly don't even know if I'm doing it right.

Probably you could use something less interactive.

alternatives --set java /your/favorite/version

should work. Or you can use 'expect' command to emulate user input.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM