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 3438940
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:14:54+00:00 2026-05-18T08:14:54+00:00

#!/bin/bash i=0 echo echo ################## echo LAUNCHING REQUESTS echo COUNT: $2 echo DELAY: $3

  • 0

#!/bin/bash

i="0"

echo ""
echo "##################"
echo "LAUNCHING REQUESTS"
echo "  COUNT:  $2 "
echo "  DELAY:  $3 "
echo "  SESSID: $1"
echo "##################"
echo ""

while [ $2 -gt "$i" ]
do
  i=$[$i+1]
  php avtest.php $1 $4 &
  echo "EXECUTING REQUEST $i"
  sleep $3
done

here is a better/modified script in bash


#!/bin/bash

i="0"
#startTime=`date +%s`
startTime=$(date -u +%s)
startTime=$[$startTime+$1+5]
#startTime=$($startTime+$1+5)
dTime=`date -d @$startTime`
echo ""
echo "##################"
echo "LAUNCHING REQUESTS"
echo "  COUNT:  $1 "
echo "  DELAY:  1 "
#echo "  EXECUTION:  $startTime "
echo "  The scripts will fire at :  $dTime "
echo "##################"
echo ""

while [ $1 -gt "$i" ]
do
  i=$[$i+1]
  php avtestTimed.php $1 $3 $startTime &
  echo "QUEUEING REQUEST $i"
  sleep 1
done

  • 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-05-18T08:14:55+00:00Added an answer on May 18, 2026 at 8:14 am

    Here’s a direct translation

    #!/usr/bin/env perl
    use strict;
    use warnings;
    
    print <<HERE;
    ##################
    LAUNCHING REQUESTS
      COUNT:  $ARGV[1]
      DELAY:  $ARGV[2]
      SESSID: $ARGV[0]
    ##################
    HERE
    
    my $i = 0;
    while($ARGV[1] > $i){
        $i += 1;
        system("php avtest.php $ARGV[0] $ARGV[3] &");
        print "EXECUTING REQUEST $i\n";
        sleep $ARGV[2];
    }
    

    But it would make more sense to read the command line parameters into variables named after what they’re for and not rely on remembering argument ordering.

    A brief errata in the conversion:

    I use a here string to represent multiline text. I could also have put in multiple print statements to more closely mimic the bash version

    In bash arguments are accessed as numbered variables, starting with $1 and going up. In Perl the argument list is represented by the array @ARGV, which is numbered starting at zero (like arrays in most languages). In both bash and Perl the name of the script can be found in the variable $0.

    In Perl arrays are written as @arrayname when refering to the entire array, but they use $arrayname[index] when accessing array members. So the Perl $list[0] is like the bash ${list[0]} and the Perl @list is like the bash ${list[@]}.

    In Perl variables are declared with the my keyword; the equivalent in bash would be declare.

    I’ve used the system function for spawning background processes. Its argument can be simply the command line as you might use it in bash.

    Unlike echo, print requires to be told if there should be a newline at the end of the line. For recent versions of Perl the say function exists which will append a newline for you.

    The Perl sleep function is pretty self-explanatory.

    EDIT: Due to a typo $i in the print statement had been represented as $ni leading to runtime errors. This has been corrected.

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

Sidebar

Related Questions

Here is my script: #!/bin/bash echo Digite o local em que deseja instalar o
my script= #!/bin/bash echo ************************BEGIN LOG******************************>>/root/backup_scripts/new_scripts/vmbackup.log 2>&1 date +%m/%d/%Y %H:%M:%S $HOSTNAME>>/root/backup_scripts/new_scripts/vmbackup.log 2>&1 ruby /root/backup_scripts/new_scripts/aapxen01.rb>>/root/backup_scripts/new_scripts/vmbackup.log
My shell script: #!/bin/bash if [ $# -lt 2 ] then echo $0 :
$ cat fav #!/bin/bash for i in {1..7} do echo http://api.stackoverflow.com/1.0/users/113124/favorites?page=$i&pagesize=100 done $ ./fav
Suppose a shell script (/bin/sh or /bin/bash) contained several commands. How can I cleanly
I have the followign bash script to update mtimes for maildir files: #!/bin/bash for
Here is a command on free bsd sudo pw usermod ksbuild -s /usr/local/bin/bash how
Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script
The way you would normally include a script is with source eg: main.sh: #!/bin/bash
why does: #!/bin/bash wtf=false if [ $wtf ] || [ ! -f filethatexists.whatever ]

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.