From 6401709111fa652afa442d1d5577840baff2741c Mon Sep 17 00:00:00 2001 From: Erik Schultink Date: Mon, 4 Dec 2023 09:03:31 -0800 Subject: [PATCH] tool to create a large test file --- tools/create-large-test-file.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tools/create-large-test-file.sh diff --git a/tools/create-large-test-file.sh b/tools/create-large-test-file.sh new file mode 100755 index 000000000..5e802893d --- /dev/null +++ b/tools/create-large-test-file.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Check if the input file and number of repetitions are provided +if [ "$#" -ne 3 ]; then + printf "\033[0;31mUsage: $0 \033[0m\n" + exit 1 +fi + +input_file=$1 +repetitions=$2 +output_file=$3 + +# Check if the input file exists +if [ ! -f "$input_file" ]; then + printf "\033[0;31mError: File '$input_file' not found.\033[0m\n" + exit 1 +fi + +# Clear the output file if it already exists +> "$output_file" + +# Concatenate the file with itself specified number of times +for (( i=0; i> "$output_file" +done + +printf "\033[0;32mSuccessfully created '$output_file'.\033[0m\n"