Find the answer to your Linux question:
Results 1 to 7 of 7
Hi friends, I am new to linux and shell scripting. I need some help from you guys. Daily i need to check group of URLs and there https requests from ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    5

    How to iterate the content of a file in the shell script

    Hi friends,
    I am new to linux and shell scripting. I need some help from you guys.
    Daily i need to check group of URLs and there https requests from browser. Recently i got some command line web browsers to know the HTTPS status of the URL like curl, wget etc... Now all of i need to do is write a shell script. I will put all my URLs in a text file and my shell script should read each URL one by one and log the status along with the corresponding URL.

    Sample output:
    ./myscript.sh url.txt
    1. site - 200 OK

    Thanks in advance.

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    this will do the iteration

    for i in `cat URL.txt`
    do
    foo $i
    done

    now all you have to do is write foo
    the sun is new every day (heraclitus)

  3. #3
    Just Joined!
    Join Date
    May 2010
    Posts
    5
    How about to log the output into a file instead of standard output. How to name that log file with date and time stamp and also can i give the location where to save the log file? if so can you gimme the sample script? it would be verify helpful.

  4. #4
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    srikanth007m - I hope you are interested in learning shell script.Google "bash shell redirection" -- should give you tons of links.
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  5. #5
    Just Joined!
    Join Date
    May 2010
    Posts
    5
    Thanks Lakshmipathi for your suggestion.

  6. #6
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    Excellent resource to learn bash , Advanced Bash-Scripting Guide
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  7. #7
    Just Joined!
    Join Date
    May 2010
    Posts
    5
    Yesm i too found the same one while googline and at last i am able to wirte the script what i need exactly.
    Thanks one and all for great suggestions

Posting Permissions

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