From 90057b78e4fec4bee253cd81b2be9e0f056483ee Mon Sep 17 00:00:00 2001 From: Florian Limberger Date: Thu, 23 Apr 2020 12:54:23 +0200 Subject: [PATCH] Execute arbitrary commands in redirect inclusion The current implementation of `<|` does not handle arbitrary commands, like e.g. the `$PLAN9/src/mkhdr` file: <| cat $PLAN9/config 2>/dev/null || true Signed-off-by: Florian Limberger --- parse.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parse.go b/parse.go index 4e76540..019a1ef 100644 --- a/parse.go +++ b/parse.go @@ -113,9 +113,10 @@ func parsePipeInclude(p *parser, t token) parserStateFun { p.basicErrorAtToken("empty pipe include", t) } - args := make([]string, len(p.tokenbuf)) + args := make([]string, len(p.tokenbuf) + 1) + args[0] = "-c" for i := 0; i < len(p.tokenbuf); i++ { - args[i] = p.tokenbuf[i].val + args[i + 1] = p.tokenbuf[i].val } output, success := subprocess("sh", args, "", true)