After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703964 - external tools doesn't work with multiple grep usage
external tools doesn't work with multiple grep usage
Status: RESOLVED NOTABUG
Product: gedit-plugins
Classification: Other
Component: General
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2013-07-10 17:35 UTC by Igor Gnatenko
Modified: 2019-03-23 20:50 UTC
See Also:
GNOME target: ---
GNOME version: 3.7/3.8



Description Igor Gnatenko 2013-07-10 17:35: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
Comment 1 Ignacio Casal Quinteiro (nacho) 2013-07-10 17:39:40 UTC
I confirm this problem
Comment 2 Paolo Borelli 2014-04-13 17:27:23 UTC
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.