DHT-kademlia-P2Psec/shared_data/create_config.sh
2024-09-13 14:04:40 +09:00

16 lines
367 B
Bash

#!/bin/bash
total_files=$1
template_file="template_config.ini"
# Check if the number of files is provided and template exists
for ((i=1; i<=total_files; i++)); do
file_name="config${i}.ini"
ip=$((100+$i))
# Replace the placeholders in the template and write to the output file
sed "s/<number>/${i}/g;s/<ip>/${ip}/g" "$template_file" > "$file_name"
done