You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
552 B
Bash
28 lines
552 B
Bash
#!/bin/bash
|
|
optstring="o:"
|
|
input_files=""
|
|
|
|
while getopts ${optstring} args; do
|
|
case $args in
|
|
o) output_file=${OPTARG} ;;
|
|
:) echo "Output file required." ;;
|
|
esac
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
echo $output_file
|
|
|
|
|
|
echo "Concatenating files..."
|
|
declare -i total_size=0
|
|
for fname in "$@"; do
|
|
#TODO: Make sure this file exists and isn't a directory!
|
|
current_file_size=$(stat -c%s "$fname")
|
|
let total_size=$total_size+$current_file_size
|
|
echo "${fname} is ${total_size}b and valid."
|
|
done
|
|
|
|
cat "$@" | pv -epts "$total_size" > "$output_file"
|
|
|
|
echo "Done!"
|