Use $chr(124) instead of | when setting a variable. This should do the trick:
Code:
alias test1 {
set %cmd echo -a first line
set %cmd %cmd $chr(124) echo -a second line
set %cmd %cmd $chr(124) echo -a last line
test2 %cmd
}
alias test2 {
tokenize 124 $1-
var %tmp = 0
while (%tmp < $0) {
inc -u0 %tmp
$eval($ $+ %tmp,2)
}
}