GNOME Bugzilla – Bug 703964
external tools doesn't work with multiple grep usage
Last modified: 2019-03-23 20:50:28 UTC
Steps to reproduce: 1. Create document with: a: 1 b: 2 3. Add external tool with: #!/bin/sh a=`grep 'a:' | awk '{print($2)}'` b=`grep 'b:' | awk '{print($2)}'` echo -e "a=$a\nb=$b" > /dev/stdout Input: Current document Output: Display in bottom pane 4. Save document 5. Use this script Actual results: a=1 b= Expected results: a=1 b=2 Additional info: Try this script: #!/bin/sh b=`grep 'b:' | awk '{print($2)}'` a=`grep 'a:' | awk '{print($2)}'` echo -e "a=$a\nb=$b" > /dev/stdout Results: a= b=2
I confirm this problem
I do not think this is a bug, if you put your test input in test.txt and your test tool in test.sh and do cat test.txt | sh test.sh You will get exactly the same same result. This is due to the fact that stdin input is consumed by the first command.