此可编辑的zenity表单包含从文件(称为ip.txt)收集的信息并显示给用户。
如果用户对表单进行了更改(t.ex将ip更改为10.0.0.100而不是表单中所述的内容)我想将这些更改保存到名为newip.txt的新文件< /强>
为了澄清,请检查表格本身的打印屏幕
https://drive.google.com/file/d/0B9LHuquISrCmR3BDTnl5WXlqSVU/view?usp=sharing
grep -Eo "([0-9]{1,3}\.){3}[0-9]{1,3}" /home/user/Desktop/ip.txt >> ip.bak
ip=$(sed -n 3p /home/user/Desktop/ip.bak )
mask=$(sed -n 2p /home/user/Desktop/ip.bak)
gateway=$(sed -n 3p /home/user/Desktop/ip.bak)
dns=$(sed -n 4p /home/user/Desktop/ip.bak)
actip=$(sudo ifconfig eth1 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
gtw=$(ip route list | sed -n -e "s/^default.*[[:space:]]\([[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\).*/\1/p")
selection=$(zenity --list --height=350 --width=450 --editable --hide-column=1 \
--title="Active IP - $aktip | Gateway - $gtw " \
--column="" --column="Ändra om det behövs" --column="Adresser" \
2 "IP-address from file" "$ip" \
3 "Mask-address from file" "$mask" \
4 "Gateway-address from file " "$gateway" \
5 "Dns i file" "$dns" \))
case "$selection" in
"2")zenity --info --text="some command" ;;
"3")zenity --info --text="some command";;
"4")zenity --info --text="some command";;
"5")zenity --info --text="some command";;
"6")zenity --info --text="some command";;
esac