|
因为需要切换网络环境,自己写了一个脚本:
- #!/bin/sh
- #
- # netc initscript
- #
- ### BEGIN INIT INFO
- # Provides: netchoose
- # Required-Start: $local_fs
- # Required-Stop: $local_fs
- # Should-Start: $network
- # Should-Stop: $network
- # Default-Start: S
- # Default-Stop: 0 6
- # Short-Description: Switch the network configuration
- ### END INIT INFO
- . /lib/lsb/init-functions
- echo "1. lab"
- echo "2. dorm"
- read n
- case "$n" in
- 1)
- cp -f /etc/network/interfaces-1 /etc/network/interfaces;;
- 2)
- cp -f /etc/network/interfaces-2 /etc/network/interfaces;;
- *)
- cp -f /etc/network/interfaces-1 /etc/network/interfaces;;
- esac
- exit 0
复制代码
保存为/etc/init.d/netchoose
- # ls -l /etc/init.d/netchoose
- -rwxr-xr-x 1 root root 632 2009-02-21 15:26 /etc/init.d/netchoose
- # ln -s /etc/init.d/netchoose /etc/rcS.d/S40netchoose
复制代码
但开机时虽然显示
却没有等待用户输入,直接执行下一个脚本S40networking去了
奇怪的是在我的Debian虚拟机里这个脚本就运行得很好
把read这行换成从文件里读入就没问题了n=( `cat /home/swicol/.config/netcv`)
但这样就太不方便了
谁能帮帮忙解释一下? |
|