Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # sd.sh -- spool and sniff stdin stream to dispatch depending on contents
- #
- # Dependencies: basename, bash, cat, head, mktemp, stat, tail, tr.
- #
- set -e
- header=$(mktemp -t $(basename $0)-XXXXXX)
- trap "rm -f $header" EXIT
- head -c 262 > $header
- size=$(stat --printf="%s" $header)
- if [ $size -eq 262 -a "$(tail --bytes=5 $header | tr -d '\0')" = "ustar" ]; then
- echo "tarball: yes" 1>&2
- else
- echo "tarball: no" 1>&2
- fi
- exec cat $header -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement