30.11.2019 16:21, Peter Suetterlin пишет:
Andrei Borzenkov wrote:
Отправлено с iPhone
29 нояб. 2019 г., в 17:57, Peter Suetterlin
написал(а):
If I use the pipe, last output will be
Overall swap used: 0
WTF!? OVERALL is nicely added up in the loop, I can do echos/prints and see how it increases. After the pipe, it's zero again.
Left side of pipe is executed in sub process, so any changes to variables there are not visible in main process.
Yes, I assumed that, therefore tried the 'declare -g' to make it global, but didn't help either :(
Guess I'd have to save output in a list variable instead, then and sort it afte the loop...
You can also use another shell (zsh starts right hand side in subprocess so does not have this issue). Zsh is sufficiently compatible with bash to require minimal changes if any. -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org