- 论坛徽章:
- 0
|
使用环境变量,其他脚本从环境变量里获取!
放一个脚本:
- #!/bin/sh
- #
- GPRS_AUTH=$1
- GPRS_APN=$2
- GPRS_USERNAME=$3
- GPRS_PASSWORD=$4
- GPRS_IP_ADDR=$5
-
- export GPRS_APN
-
- if (test "CHAP" = "$GPRS_AUTH")
- then
- auth="/etc/ppp/gprs-chap"
- else
- auth="/etc/ppp/gprs-pap"
- fi
-
- if (test -n "$GPRS_USERNAME")
- then
- uid="user $GPRS_USERNAME"
- else
- uid="user none"
- fi
-
- if (test -n "$GPRS_PASSWORD")
- then
- pwd="password $GPRS_PASSWORD"
- else
- pwd="password none"
- fi
- if (test -n "$GPRS_IP_ADDR")
- then
- ip_addr="$GPRS_IP_ADDR:"
- else
- ip_addr=
- fi
-
- if (pppd file $auth $ip_addr $uid $pwd &)
- then
- while (test 1 -eq 1)
- do
- if (pgrep -x pppd > /dev/null)
- then
- sleep 1
- else
- exit 1
- fi
-
- if (ifconfig ppp0 > /dev/null)
- then
- exit 0
- fi
- done
- fi
-
- exit 1
复制代码
[ 本帖最后由 dglwx 于 2008-11-24 12:53 编辑 ] |
评分
-
查看全部评分
|