Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8893041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:09:03+00:00 2026-06-14T23:09:03+00:00

i need generate number values and uses that values on curl. i have done

  • 0

i need generate number values and uses that values on curl. i have done this but the code have some faults because can’t generate the numbers.

#!/bin/bash

for a in $(seq 0 9)
do
pass[0]="$a"
   for b in $(seq 0 9)
   do
   pass[1]="$b"
        for c in $(seq 0 9)
        do
        pass[2]="$c"
            for d in $(seq 0 9)
            do
            pass[3]="$d"
                for e in $(seq 0 9)
                do
                pass[4]="$e"
                    for f in $(seq 0 9)
                    do
                    pass[5]="$f"
                   curl -d "$a$b$c$d$e$f" somesite.php
                    done
                done
             done
         done    
     done
done

i get this output:

   echo ${pass[*}
>                     done
> 
Display all 289 possibilities? (y or n)
> e
>              done
>          done    
>      done
> done
> ^C
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:09:04+00:00Added an answer on June 14, 2026 at 11:09 pm

    Simpler (but still ghastly):

    for a in $(seq 0 9)
    do
        for b in $(seq 0 9)
        do
            for c in $(seq 0 9)
            do
                for d in $(seq 0 9)
                do
                    for e in $(seq 0 9)
                    do
                        for f in $(seq 0 9)
                        do
                            curl -d "$a$b$c$d$e$f" somesite.php
                        done
                    done
                done
            done    
        done
    done
    

    I’m not convinced that the script you copied to the question is the one you executed. When I do run your script, it executes commands like:

    curl -d 0 2 0 8 7 9 somesite.php
    

    Note the spaces; I suspect they are (a) unwanted and (b) largely unavoidable without futzing with IFS, which is worse than fixing the code as I showed. Arrays are great; they aren’t for everything.

    Incidentally, it would be simpler (by far) to use:

    for number in $(seq -f '%06.0f' 0 1000000)
    do
        curl -d "$number" somesite.php
    done
    

    or:

    seq -f '%06.0f' 0 1000000 |
    while read number
    do
        curl -d "$number" somesite.php
    done
    

    or … there are other ways to do it too (see other answers). The seq | while read loop has the advantage of not needing more than 7 MiB of memory to store the numbers.

    It’s going to take a while to curl one million pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to randomly generate a number of values in a batch file that
I need to generate report that will show number of new / changed rows
Like my question, i need to generate random numbers that have identical pairs between
I have a loop that takes values from textboxes and dropdowns and uses them
I need to generate random numbers based on multiple seed values, need some ideas
I need to generate a unique serial number in our web application. I have
A specific example I need to generate a random number between 0 and 2,
I need to generate a random port number between 2000-65000 from a shell script.
I need to generate a lot of random numbers. I've tried using random.random but
I need to make an application which dynamically generates some number of forms and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.