File: 017-numeric-bytes

package info (click to toggle)
pv 1.5.7-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 816 kB
  • ctags: 361
  • sloc: ansic: 4,218; sh: 669; makefile: 17
file content (19 lines) | stat: -rw-r--r-- 501 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
#
# Check that numeric output gives a byte count instead of a percentage when
# used with -b.

# Process 500 bytes at 500 bytes per second, updating every 0.1 seconds for
# around 10 output lines.
#
dd if=/dev/zero bs=500 count=1 2>/dev/null \
| $PROG -s 500 -n -b -i 0.1 -L 500 >/dev/null 2>$TMP1

# The number of output lines should be >8 and <13, and the final byte count
# should be 500.
#
test `wc -l < $TMP1` -gt 8
test `wc -l < $TMP1` -lt 13
test `sed -n '$p' < $TMP1` -eq 500

# EOF