summaryrefslogtreecommitdiffstats
path: root/src/kash/tests/pipe-2
blob: 6ba26376e522e69007a481bf1f59c914dc6093e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

# Pipes input from an builtin command thru an external one.

. ${KASH_TEST_DIR}/common-include.sh

TMPFILE1="/tmp/pipe-2a.$$.tmp"
TMPFILE2="/tmp/pipe-2b.$$.tmp"
echo piped > $TMPFILE1
$CMD_CAT $TMPFILE1 \
	| $CMD_SED -e 's/piped/abc/' \
	| $CMD_SED -e 's/abc/def/'  \
	| $CMD_SED -e 's/def/ghi/'  \
	| $CMD_SED -e 's/ghi/jkl/'  \
	| $CMD_SED -e 's/jkl/mno/'  \
	| $CMD_SED -e 's/mno/pqr/'  \
	| $CMD_SED -e 's/pqr/stu/'  \
	| $CMD_SED -e 's/stu/vwx/'  \
	| $CMD_SED -e 's/vwx/yz_/'  \
	> $TMPFILE2

VAR=`$CMD_CAT $TMPFILE2`
$CMD_RM -f -- $TMPFILE1 $TMPFILE2
if test "$VAR" != "yz_"; then
    echo "pipe-2: FAILURE - VAR=$VAR"
    exit 1
fi
echo "pipe-2: SUCCESS"
exit 0