关于shell读取文件
不想在shell上花费过多时间。只是想读取一个文件,并把文件中的内容设置给一个变量,成功代码如下
#!/bin/sh
thepath=''
#cat upper.sh | while read line
#do
# echo $line
# thepath=$thepath:$line
#done
#echo $thepath
while read line
do
thepath=$thepath:$line
done < upper.sh
echo $thepath
注意代码中注释掉的部分,由于管道的问题变量thepath不能设置成功。所以不得不用后面代码的部分方能成功设置变量。