Find the answer to your Linux question:
Results 1 to 7 of 7
Hi, i want to write a shell script about wget for download picture. i want to enter web site adress and type of file and script will download files which ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    28

    wget

    Hi,


    i want to write a shell script about wget for download picture.
    i want to enter web site adress and type of file
    and script will download files which are defined on entered web site.

    how can i do it?
    thanks
    Last edited by Utnubu; 01-15-2010 at 10:06 AM. Reason: wrong question

  2. #2
    Just Joined! sedbean's Avatar
    Join Date
    Jan 2010
    Posts
    3
    Code:
    wget -r google.com --accept=jpg,jpeg
    Not entirely sure whether it works or not ( writing out of my head ) - let us know the outcome

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Posts
    28
    thanks but how can i do it with script.

    bash shell script.
    i want to enter web site and type of picture with argument.
    for example

    ./trial.sh Open Source and Linux Forums jpg

    help me

  4. #4
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Utnubu, you need to read up on shell scripting. All of your questions so far have been really simple questions that you could find the answer to with Google much faster than you could from a forum

    It's better to have a go yourself first and ask when you run into problems you cannot solve
    Linux User #453176

  5. #5
    Just Joined!
    Join Date
    Dec 2009
    Posts
    28
    i am trying it. i didnt ask directly to forum. i've been researching.
    if i know how to pass arguments to command line, i will do it.

    thanks
    Last edited by Utnubu; 01-16-2010 at 10:20 AM. Reason: edit

  6. #6
    Just Joined!
    Join Date
    Dec 2009
    Posts
    28
    i think its not like this, can you have a look?

    first parameter web site
    second one is type
    third one is directory

    #!/bin/bash
    wget *-r *-l1 *-accept='$2' *-P ~/'$3' '$1'

  7. #7
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Yes, $1 would be the first argument, $2 the second and so on

    I'm not sure why you have and * in there though. Try:

    Code:
    #!/bin/bash
    wget -r -l1 -accept='$2' -P ~/'$3' '$1'
    Linux User #453176

Posting Permissions

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