39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Define database connection variables
|
|
db_host="your_db_host"
|
|
db_user="your_db_user"
|
|
db_pass="your_db_password"
|
|
db_name="your_db_name"
|
|
db_table="your_db_table"
|
|
|
|
# Define path to dictionary file
|
|
dictionary_file="path_to_your_dictionary_file"
|
|
|
|
# Check if dictionary file exists
|
|
if [ ! -f "$dictionary_file" ]; then
|
|
echo "Dictionary file not found."
|
|
exit 1
|
|
fi
|
|
|
|
# Function to insert combination into the database
|
|
insert_into_database() {
|
|
local combined_word="$1"
|
|
mysql -h "$db_host" -u "$db_user" -p"$db_pass" "$db_name" -e "INSERT INTO $db_table (combined_word) VALUES ('$combined_word');"
|
|
}
|
|
|
|
# Loop through each word in the dictionary
|
|
while read -r word1; do
|
|
while read -r word2; do
|
|
# Concatenate the two words
|
|
combined_word="$word1$word2"
|
|
|
|
# Insert the combined word into the database
|
|
insert_into_database "$combined_word"
|
|
echo "Inserted combination $combined_word into database."
|
|
done < "$dictionary_file"
|
|
done < "$dictionary_file"
|
|
|
|
echo "All combinations inserted into database."
|
|
|