| #!/bin/sh -efu |
| |
| # Copyright 2012 Intel Corporation |
| # Author: Artem Bityutskiy |
| # License: GPLv2 |
| |
| srcdir="$(readlink -ev -- ${0%/*})" |
| PATH="$srcdir:$srcdir/helpers/libshell:$PATH" |
| |
| . shell-error |
| |
| PROG="${0##*/}" |
| |
| show_usage() |
| { |
| cat <<-EOF |
| Usage: $PROG <mbox_files> |
| |
| <mbox_files> - a list of mbox files to concatenate. |
| |
| This is a simple script which concatenates several mbox files into one. The |
| resulting mbox is printed to stdout. |
| |
| Note, using just "cat" to contatenate the files is not going to produce a |
| correct mbox because there won't be the required blank line between the e-mails |
| in the resulting mbox. |
| EOF |
| } |
| |
| fail_usage() |
| { |
| [ -z "$1" ] || printf "%s\n" "$1" |
| show_usage |
| exit 1 |
| } |
| |
| [ "$#" -gt 0 ] || fail_usage 'Please, specify at least one file' |
| |
| while [ "$#" -ge 2 ]; do |
| cat "$1" |
| printf "\n" |
| shift |
| done |
| |
| cat "$1" |