init_net.sh

#!/bin/bash

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
ONBOOT=yes
DEVICE=
GATEWAY=
NETMASK=
IPADDR=

CENTOS_NET_CONF=/etc/sysconfig/network-scripts
FIND_DEVICE_FILE=cat 

if ! test -d $CENTOS_NET_CONF; then
	echo "not exist $CENTOS_NET_CONF"
fi

function is_ip() {
	str="$@"
	ipV4=()
	len=0
	n=""
	for i in `seq ${#str}`
	do
		v=${str:$i-1:1}
		echo $v | [[ `sed -n '/^[0-9][0-9]*$/p'` ]]
		if [[ $? == 0 ]]; then
			n=$n$v
		else
			if [[ "$v" == '.' ]]; then
				if [[ $n -lt 256 ]]; then
					ipV4[$len]=$n
					len=$(($len+1))
					n=""
				else
					echo "$n not in [0-255]"
					exit
				fi
			else
				echo "$v not num"
				exit
			fi
		fi
	done
	if [[ $n -lt 256 ]]; then
		ipV4[$len]=$n
		len=$(($len+1))
		n=""
	else
		echo "$n not in [0-255]"
		exit
	fi
	if [[ $len != 4 ]]; then
		echo "$str is not ip format"
		exit
	fi
	# echo "$len -> ${ipV4[@]}"
	return $ipV4
}

read -p "Please input Network card name:" DEVICE

read -p "Please input IPADDR:" IPADDR
is_ip $IPADDR

read -p "Please input GATEWAY:" GATEWAY
is_ip $GATEWAY

read -p "Please input NETMASK:" NETMASK
is_ip $NETMASK

OUT_PUT="TYPE:$TYPE\nBOOTPROTO:$BOOTPROTO\nDEFROUTE:$DEFROUTE\nONBOOT:$ONBOOT\nDEVICE:$DEVICE\nIPADDR:$IPADDR\nGATEWAY:$GATEWAY\nNETMASK:$NETMASK\n"

printf $OUT_PUT > "$CENTOS_NET_CONF/ifcfg-$DEVICE"


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1.2.14\AirtestIDE\airtest\core\android\static\adb\windows\adb.exe -P 5037 -s f19e7fbe shell ls [21:51:10][ERROR]<airtest.core.api> Traceback (most recent call last): File "airtest\core\android\adb.py", line 374, in shell File "airtest\core\android\adb.py", line 332, in raw_shell File "airtest\core\android\adb.py", line 197, in cmd airtest.core.error.AdbError: stdout[b'acct\r\napex\r\nbin\r\nbugreports\r\ncache\r\ncharger\r\nconfig\r\ncust\r\nd\r\ndata\r\ndebug_ramdisk\r\ndefault.prop\r\ndev\r\netc\r\nlost+found\r\nmnt\r\nodm\r\noem\r\nproc\r\nproduct\r\nproduct_services\r\nres\r\nsbin\r\nsdcard\r\nstorage\r\nsys\r\nsystem\r\nvendor\r\n'] stderr[b'ls: ./init.zygote64_32.rc: Permission denied\r\nls: ./init.rc: Permission denied\r\nls: ./init.usb.rc: Permission denied\r\nls: ./ueventd.rc: Permission denied\r\nls: ./init.zygote32.rc: Permission denied\r\nls: ./init.recovery.hardware.rc: Permission denied\r\nls: ./init: Permission denied\r\nls: ./init.miui.google_revenue_share_v2.rc: Permission denied\r\nls: ./init.miui.cust.rc: Permission denied\r\nls: ./init.environ.rc: Permission denied\r\nls: ./init.miui.post_boot.sh: Permission denied\r\nls: ./init.miui.qadaemon.rc: Permission denied\r\nls: ./verity_key: Permission denied\r\nls: ./init.recovery.qcom.rc: Permission denied\r\nls: ./init.miui.rc: Permission denied\r\nls: ./init.usb.configfs.rc: Permission denied\r\nls: ./init.exaid.hardware.rc: Permission denied\r\nls: ./init.miui.google_revenue_share.rc: Permission denied\r\nls: ./init.miui.nativedebug.rc: Permission denied\r\nls: ./init.miui.early_boot.sh: Permission denied\r\nls: ./metadata: Permission denied\r\n'] During handling of the above exception, another exception occurred:
07-25

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值