1 |
#!/bin/bash |
2 |
|
3 |
### time block |
4 |
# bash and mksh work; dash does't. TODO: test substring |
5 |
{ time { sleep 0.01; sleep 0.02; } } 2>_tmp/time.txt |
6 |
cat _tmp/time.txt | grep --only-matching real |
7 |
# Just check that we found 'real'. |
8 |
# This is fiddly: |
9 |
# | sed -n -E -e 's/.*(0m0\.03).*/\1/' |
10 |
# |
11 |
# status: 0 |
12 |
# stdout: real |
13 |
# BUG dash status: 2 |
14 |
# BUG dash stdout-json: "" |
15 |
|
16 |
### Exit builtin |
17 |
exit 3 |
18 |
# status: 3 |
19 |
|
20 |
### Exit builtin with invalid arg |
21 |
exit invalid |
22 |
# Rationale: runtime errors are 1 |
23 |
# status: 1 |
24 |
# OK dash/bash status: 2 |