Find the answer to your Linux question:
Results 1 to 2 of 2
Hello, I have made a Linux Shell Script that downloads 6 files from the Internet and then deletes them. Now i want to use the function "/usr/bin/time" and "bc" to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    1

    Question /usr/bin/time Shell Scripting Function


    Hello, I have made a Linux Shell Script that downloads 6 files from the Internet and then deletes them. Now i want to use the function "/usr/bin/time" and "bc" to calculate how long the avergate run time for the shell script is. I therefore need to do it 100 times. My shell script code is below:

    Code:
    #!/bin/bash
    
    #!/bin/bash/
    for I in {1..6}
    do
            echo "Downloading file number $I "
            wget --user=os --password=yda htt!p://osyda50.hive.no/0$I.html
    
            echo "Deleting file number $I "
            rm 0$I.html
    done

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Must you use /usr/bin/time? I'd either just use Bash's built-in time function, or use date +%s before and after the loop, then calculate the difference.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •