[root@localhost Hamilton]# cat LuxBIOSModifyPXENew.sh LuxBIOSResetPXENew.sh #!/bin/bash #instruction:通用BIOS选项修改脚本,使用时只需修改sed_file入参 # 1.export the BIOS config file; # 2.modify the PXE BOOT OPTIONs; # 3.import the BIOS config file; V_DIFFLINES=10 v_exportfile="/tmp/BIOS.script.log" v_exportfile2="/tmp/BIOS.script.log2" v_tmpfile="/tmp/tmp.origin" v_importfile="/tmp/BIOS.import.log"
#instruction:根据BIOS的token匹配唯一行,并以此行为基准加偏移行修改2行对应Option的内容,达到修改BIOS配置的目的 #input:1.input_file---输入的BIOS config文件; # 2.string_match---对应匹配的token字符串(TOKEN NO); # 3.add_line1---行偏移量1; # 4.add_line2---行偏移量2; # 5.string_replace1---需要替换成的字符串1; # 6.string_replace2---需要替换成的字符串2; #output:打印输出重定向文件 function sed_file() {
input_file=$1 string_match=$2 add_line1=$3 add_line2=$4 string_replace1=$5 string_replace2=$6
#echo "string_match=$string_match,string_replace1=$string_replace1,string_replace2=$string_replace2" v_line=$(cat -n $input_file|grep "Do NOT change this line"|egrep "$string_match[[:blank:]]"|awk '{print $1}') v_line1=$(( $v_line + $add_line1 ))
推荐阅读
发表评论