#!/bin/bash # Check if the required arguments are provided if [ $# -ne 2 ]; then echo "Usage: ${0##*/} " exit 1 fi # Assign the arguments to variables file_path=$1 copy_count=$2 # Check if the file exists if [ ! -f "$file_path" ]; then echo "Error: File not found: $file_path" exit 1 fi # Get the file name and directory file_name=$(basename "$file_path") file_dir=$(dirname "$file_path") # Generate the copies for ((i=1; i<=$copy_count; i++)); do new_file_name="${file_name%.${file_name##*.}}_${i}.${file_name##*.}" cp "$file_path" "$file_dir/$new_file_name" done