Compiling incomplete redir is now safe.

This commit is contained in:
Qi Xiao 2016-02-07 19:10:52 +01:00
parent d4e8659853
commit 70f362667a

View File

@ -282,7 +282,8 @@ func (rn *Redir) parse(ps *parser, dest *Compound) {
if parseSep(rn, ps, '&') {
rn.SourceIsFd = true
}
if !startsCompound(ps.peek()) {
rn.setSource(parseCompound(ps))
if len(rn.Source.Indexings) == 0 {
if rn.SourceIsFd {
ps.error(shouldBeFd)
} else {
@ -290,7 +291,6 @@ func (rn *Redir) parse(ps *parser, dest *Compound) {
}
return
}
rn.setSource(parseCompound(ps))
}
func isRedirSign(r rune) bool {