shell_循环中改变循环外的变量

shell_循环中改变循环外的变量

sys_include_dir=""
for var in $(find /usr /lib -type d -a -name include)
do
    sys_include_dir+="${var}:"
done
sys_include_dir=$(
find /usr /lib -type d -a -name include | while read var
do
    echo -n "${var}:"
done
)

使用HERE-Document

#!/bin/sh
OUTFILE=`ls -l | grep -v total`
while read line
do
  all="$all $line"
  echo $line
done <

你可能感兴趣的:(shell_循环中改变循环外的变量)