NAME="pb>x;!wc -c x"
FILE=malloc://1024
CMDS=<<EOF
p8 10 > dump
!wc -c dump|awk "{print \$1}"
p8 12800 > dump
!wc -c dump|awk "{print \$1}"
!rm -f dump
EOF
EXPECT=<<EOF
21
25601
EOF
RUN

NAME="p8|sed -e s,1,x,g>x;cat x;rm x"
FILE=malloc://512
CMDS=<<EOF
wv 0x100
p8 8| sed -e s,1,x,g>x;!dos2unix x;cat x;rm x
EOF
EXPECT=<<EOF
000x000000000000
EOF
RUN

NAME=append to file
FILE==
CMDS=<<EOF
echo Hello > .rz-append-to-file.test
echo World >> .rz-append-to-file.test
cat .rz-append-to-file.test
rm .rz-append-to-file.test
EOF
EXPECT=<<EOF
Hello
World
EOF
RUN

NAME=stacked redirect
FILE==
CMDS=<<EOF
# inner redirect to file
(mac1; echo a>.rz-stacked-redirect.txt; echo b)
# outer redirect to alias, any other feature which redirects output to buffer like the builtin grep ~ would also work
.(mac1) > $al1
echo "---"
cat .rz-stacked-redirect.txt
echo "---"
$**
rm .rz-stacked-redirect.txt
EOF
EXPECT=<<EOF
---
a
---
$al1=$b

EOF
RUN