我是自动计算脚本,我的核心执行逻辑如下:
echo 'Etotal=$(grep'" 'Band Gap'"' BAND_GAP|tail -1|awk'" '{print"' $6}'"')">>input-spin-band-dos
echo 'val1=$(echo "$Etotal" | bc)'>>input-spin-band-dos
echo ' result=$(echo "$val1 0" | awk'" '"'{ if ($1 > $2) print 1; else print 0 }'"')" >>input-spin-band-dos
echo 'if [ $result == 1 ]'>>input-spin-band-dos
echo 'then'>>input-spin-band-dos
echo 'printf "%6s%18s\n" "this materials is semiconductor with a band gap of"" "$Etotal" ""eV" >>analyse'>>input-spin-band-dos
echo 'else'>>input-spin-band-dos
echo 'grep "%6s%18s\n" "this materials is metal" >>analyse'>>input-spin-band-dos
echo 'fi '>>input-spin-band-dos
echo '} '>>input-spin-band-dos
|