blob: 2df30b3c1e58d85a485427dc8633b67df42da6ca (
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
31
32
33
|
# z/OS: running TSO/E commands from the shell.
#
# tso(1) is an ordinary program to zash, but it is the one most likely to
# be affected by how the shell creates processes (spawn, _BPX_SHAREAS),
# so it gets its own checks. Skipped when tso is not available.
#
# VERIFY: written from documentation, not yet run.
command -v tso >/dev/null 2>&1 || exit 77
tso -t "TIME" >out 2>&1
echo "TIME: $?"
grep -c 'TIME-' out
# In a pipeline, in command substitution, and in the background.
tso -t "TIME" 2>/dev/null | grep -c 'TIME-'
t=$(tso -t "TIME" 2>/dev/null); case $t in *TIME-*) echo "command substitution" ;; esac
tso -t "TIME" >bg 2>&1 &
wait $!; echo "background: $?"
# The same with the child sharing the shell's address space.
_BPX_SHAREAS=YES tso -t "TIME" 2>/dev/null | grep -c 'TIME-'
_BPX_SHAREAS=NO tso -t "TIME" 2>/dev/null | grep -c 'TIME-'
# A failing TSO command gives a non-zero status that if and || see.
if tso -t "LISTDS 'NO.SUCH.DATASET.ZASH'" >/dev/null 2>&1; then
echo "unexpected success"
else
echo "failure seen by if"
fi
tso -t "NOSUCHCOMMANDZASH" >/dev/null 2>&1 || echo "unknown command fails"
# Output in EBCDIC is readable in the pipeline whatever the shell's mode.
tso -t "LISTALC" 2>/dev/null | head -n 1 | grep -c .
|