Added an error if the output file already exists.

dev
Emily Frost 5 years ago
parent 62f4e3a463
commit 5a5ef628dc
Signed by: Emily
GPG Key ID: AA5D42849F1CBDC9

11
nyan

@ -43,7 +43,13 @@ if [ -z "$output_file" ]; then
exit 1 exit 1
fi fi
echo "Concatenating files..." # TODO: Add overwrite switch.
if [ -e "$output_file" ]; then
echo "Error: Output file exists."
exit 1
fi
echo "Preparing to concatenate files."
declare -i total_size=0 declare -i total_size=0
for fname in "$@"; do for fname in "$@"; do
if [ ! -e "$fname" ]; then if [ ! -e "$fname" ]; then
@ -59,8 +65,7 @@ for fname in "$@"; do
fi fi
done done
# TODO: Make sure that output_file does not exist. Maybe add an overwrite switch. echo "Concatenating files..."
if [ $abort -eq 0 ]; then if [ $abort -eq 0 ]; then
cat "$@" | pv -epts "$total_size" > "$output_file" cat "$@" | pv -epts "$total_size" > "$output_file"
echo "Done!" echo "Done!"

Loading…
Cancel
Save