进程替换:
#! /bin/bashvar=$(cat urfile)
echo "Process Substitution"
while read line
do
echo "$line"
done < <(echo "$var")
管道:
#! /bin/bashvar=$(cat urfile)
echo "Pipe"
echo "$var" | while read line
do
echo "$line"
done
here document:
#! /bin/bashvar=$(cat urfile)
echo "Here Document"
while read line
do
echo "$line"
done <<EOF
$var
EOF
here string:
#! /bin/bashvar=$(cat urfile)
echo "Here String"
while read line
do
echo "$line"
done <<< "$var"
没有评论:
发表评论