Public feed #528494

recursive combine in shell

public shellscript v1 · immutable
Raw Edit
·published 2007-06-01 16:04 UTC
rendered paste body
# MIX TOGETHER WORDS IN A LIST AND CHECK IF THEY'RE AVAILABLE AS DOMAIN NAMES# HOWEVER THIS THING CONSISTS OF TWO DIFFERENT SCRIPTS THAT I CAN'T SEEM TO MERGE TOGETHER# Usage: domains_list.sh <input> <output> <combos> <suffix> <retries>input=$1; output=$2; combos=$3; suffix=$4; retries=$5; # --- BEGINNING OF FIRST SCRIPT ---# Read from input#array=($(<"$input"));# Mix the names together#function mix () {    if (($1 < 1)); then echo "$name"            else for x in "${array[@]}"; do echo "$(combos $(($1-1)) $x$name)"; done		    fi     }    # --- BEGINNING OF SECOND SCRIPT ---# If they're available, let us know#while true; do    tries=0    while ((tries<retries)); do        result=$(whois "$name" 2>&1) || { ((tries++)); sleep 1; continue; }        if grep -q 'No match' <<< "$result"; then echo "+ $name"; echo $name >> "$output"; else echo "- $name"; fi        break    done    # If there's an error    #    if ((tries==3)); then echo "/ $name"; fi    # Get some rest    #    sleep $delaydone