PACKAGES=`cat packages.txt` i=1 for PACKAGE in $PACKAGES do array[$i]=" <package>$PACKAGE</package>" (( i++ )) done anz=$(( ${#array[@]} )) for ((i=1; i<=$anz ; i++)) do echo ${array[$i]}; done
data1=$(cat <<EOF a b c EOF ) echo "$data1"