chiark / gitweb /
timeout.1: Include exit status documentation in the manual.
[misc] / buf
CommitLineData
3770fe80 1#! /bin/sh
2
3set -e
4case "$#:$1" in
5 0:* | 1:-h | 1:--help)
6 echo "Usage: $0 PROG ARGS..."
7 echo " Buffer stdin to temp file and pass to PROG with ARGS"
8 exit 0
9 ;;
10esac
11tmp=${TMPDIR-/tmp}/buf-$$
12mkdir "$tmp"
13trap 'rm -rf "$tmp"' INT QUIT TERM HUP EXIT
14cat >"$tmp/buf"
15set +e; "$@" "$tmp/buf"; st=$?; set -e
16trap '' INT QUIT TERM HUP EXIT
17rm -rf "$tmp"
18exit $st