shell脚本之-向⽂件中写⼊数据
#!/bin/sh
#zhidao.baidu/question/262951766.html
#blog.csdn/roadmore/article/details/90546407  blog.csdn/jk110333/article/details/8590746/ if [$# -eq 0]; then
  mode='upgrade'
else
  mode=$1
fi
mydir=$(dirname "$0")
cd $mydir
CURRENT_DIR='pwd'
version_dir="/home/example"
version_info=‘shellscript_excrise_01’
devicename='echo "${HOSTNAME}"'
strdevip='su - usera -c "cmd | grep ipaddress|head -n 1"'
deviceip ='echo ${strdevip} | awk -F "=" '/ipaddress/ {print $2}' | tr -d' '
updatetime='date + "%Y.%m.%d %T" '
versionflow_list
if ["$mode"=="upgrade"]; then
shell代码  sed -i "/$verdionflow_dir/d" ${versionflow_list}
  echo "${devicename},${deviceip},${versioninfo},${updatetime}">>${versionflow_list}
elif
fi
exit 0

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。