[PATCH] dim: replace pipe commands with single sed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A single sed can do the job of taking the second line after a match and
it looks simpler.

Signed-off-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>
---

I noticed this while reviewing "[PATCH 2/4] dim: shut up sed broken pipe
noise in apply-pull".

 dim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dim b/dim
index 6b684ba5308c..f7cf255db3e1 100755
--- a/dim
+++ b/dim
@@ -924,7 +924,7 @@ function dim_apply_pull
 
 	cat > $file
 
-	pull_branch=$(sed -e '0,/[gG]it repository at:$/d' $file | head -n 2 | tail -n 1)
+	pull_branch=$(sed -ne '/[gG]it repository at:$/{n;n;p}' $file)
 
 	if [[ -z "$pull_branch" ]] ; then
 		echoerr "no pull request found"
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux