The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
wget --dns-timeout script veerumahanthi41 UNIX for Dummies Questions & Answers 1 12-08-2008 02:09 AM
help with wget script. veerumahanthi41 Shell Programming and Scripting 3 11-30-2008 11:23 PM
How to script wget in bash? siegfried Shell Programming and Scripting 1 12-25-2007 03:57 AM
Script to download file using wget techie82 Shell Programming and Scripting 1 02-13-2007 07:45 PM
Wget call in a Perl script rahulrathod UNIX for Advanced & Expert Users 1 12-28-2005 06:45 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-16-2009
Altay_H Altay_H is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 11
Using wget in a Perl script

Hi,
I've written a script in Perl that generates a URL and prints it. So if I run the script from the command line, I get something like this:

Code:
$ script.pl
http://www.url.com/folder/file.ext

I would like to use this script with wget to download the file at the URL generated. Is there a simple way to redirect the output of a perl script to wget so that I can download the file using the script?

I couldn't think of any way to do this, so my thought was to output the URL to a file, then write a shell script to read the contents of the file and call wget with the correct URL, but this seems like an unnecessarily complicated solution. Is there an easy way to call wget from a Perl script?

Thanks for any help!
  #2 (permalink)  
Old 01-16-2009
Rhije Rhije is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 103
Thats easy! Just use either backticks or.. var substitution.. such as..


Code:
test=$(perl -e "print 'Hi hi hi hi';");echo $test;

or...


Code:
echo `perl -e "print 'Hello World';"`

So you could easily do..


Code:
wget `perl script.pl`

Have fun!
  #3 (permalink)  
Old 01-16-2009
Altay_H Altay_H is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 11
Thanks!

Thanks! I knew there had to be an easy way...
Closed Thread

Bookmarks

Tags
perl, wget

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0