#1338·sh

interp: aliases cannot contain pipes

Author: alexflintCreated May 19, 2026Updated May 21, 2026

Running alias a='b | c' through interp produces this error:

`|` is not a valid word

This is because the interpreter processes aliases by parsing the expression on the right as a sequence of words here. There is a suggestive TODO just above those lines:

// TODO: parse any CallExpr perhaps, or even any Stmt

However, further down the line it seems that a slice of words is needed in order to call expand.Fields. I guess this is actually a pretty non-trivial change because parsing arbitrary CallExprs or Stmts within aliases will necessitate some AST surgery later on in order to replace the aliased word/token with the parsed CallEpr or Stmt.

Any advice on how to implement this?