shell脚本怎样把一个文件的内容赋值给一个变量

如题所述

  linux 将文件内容赋值给shell脚本中的变量:
  1#!/bin/sh
  2 maildir=baikewaringmail
  3 lastVersion=xxxxxxxxxxxxxx/lastVersion/datestr.txt
  4 mydatestr=`sed -n '1p' $lastVersion`
  5 echo "the datestr is $mydatestr"
温馨提示:答案为网友推荐,仅供参考
相似回答