Create an interactive Linux boot-general Linux technology-Linux programming and kernel information. The following is a detailed description. Previously, I wrote a program that runs automatically at startup. However, for various reasons, when the program runs, it reports a segment error. Only the system is reinstalled or the system is started with a CD to delete the Automatic startup Item. however, this is too troublesome, so I thought that the DOS system has a F8 key, and you can select a startup Item for startup.
To enable the single-step startup of DOS by pressing the F8 key during startup to select the startup Item, I modified the startup script/etc/rc. d/rc. local:
Method 1
#! /Bin/bash
# In 2 seconds, the program runs automatically without entering y + press Enter. Otherwise, the program is not executed.
Read-t 2 arg
Case $ arg in
Y)
Exit 1
;;
*)
;;
Esac
./Programs to be automatically executed
-----------
Method 2
The interpreter may not recognize the corresponding read-t 2 arg.
Another method:
Old_stty = 'stty-G'
Stty-icanon min 0 time 20 #2 seconds
Eval read arg
Stty "$ old_stty"
Case $ arg in
...
-------------
The first method is relatively easier, and the second method is more adaptable.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service