Bash Script Loop Out of Memory?
问题 In bash I need to run a script that loops from i=1 to i=99999999 but it always run out of memory. Is there any workaround? or is there a max value for i? first=1 last=99999999 randomString="CXCXQOOPSOIS" for val in $( seq $first $last ) do padVal=$( printf "%010d\n" $val ) hash=$( echo -n $randomString$padVal | md5sum ) if [[ "$hash" =~ ^000000) ]]; then echo "Number: $val" >> log_000000 echo "$val added to log - please check." fi done 回答1: bash provides C-like syntax for loop: first=1 last