我不能为我的生活看到为什么我不能在while循环之外阅读postPrioity.
我试过“export postPrioity =”500“”仍然无法正常工作.
有任何想法吗?
– 或在计划文本中 –
#!/bin/bash
cat "/files.txt" | while read namesInFile; do
postPrioity="500"
#This one shows the "$postPrioity" varible, as '500'
echo "weeeeeeeeee ---> $postPrioity
done
#This one comes up with "" as the $postPrioity varible. GRRR
echo "weeeeeeeeee ---> $postPrioity
OUTPUT :(我在files.txt中只有3个文件名)
weeeeeeeeee ---> 500
weeeeeeeeee ---> 500
weeeeeeeeee ---> 500
weeeeeeeeee --->