C# .net core XmlDocument 使用Load和Save方法

代码: string path =”C://xxx/file” XmlDocument xmlDoc = new XmlDocument(); #if NET462 xmlDoc.Load(path); #else string content = File.ReadAllText(path); xmlDoc.LoadXml(content.Trim()); #endif …… …… #if NET462 xmlDoc.Save(path); #else FileStream fs = new FileStream(path, FileMode.Create); XmlWriterSettings settings = new … “C# .net core XmlDocument 使用Load和Save方法”

Read More

Ubuntu设置IP和hostname的shell脚本

以前有段时间经常新配虚拟机搭Kubrenetes环境,于是写了个shell脚本提示性输入配置,今天翻到了发上来. #!/bin/bash # By Swire Chen if [[ (whoami) == “root” ]];then echo “当前执行权限: root” else echo “当前用户:”(whoami) echo “请使用管理员权限执行脚本.” exit fi while read -p “是否设置本机静态IP,退出输入:n,设置IP输入:y [y|n]” yn do if [[ {yn} == [Nn] ]];then … “Ubuntu设置IP和hostname的shell脚本”

Read More