LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 10-14-2008, 04:55 PM   #1
dirk
LQ Newbie
 
Registered: Jan 2006
Distribution: debian
Posts: 17

Rep: Reputation: 0
Random image script?


Hello,I am trying to make a script that downloads a random image from the internet and sets it as my background.I am not very good at this so any help is much appreciated .So far i have something like this

Code:
#!/bin/sh
curl http://www.randomimage.us/index.php -o tmp.txt
cat tmp.txt | grep .jpg | xargs curl -o tmp.jpg
fbsetbg tmp.jpg
There is probably a easier way to do this but I dont know lol.
The problem I have here is with grep,I need it to only grep the url and not everything on that line.How can I do this?
Any help much appreciated
Thanks
 
Old 10-14-2008, 06:08 PM   #2
dirk
LQ Newbie
 
Registered: Jan 2006
Distribution: debian
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks to repz on the #linux channel on freenode I have got this to work.
Code:
#!/bin/sh
curl http://www.randomimage.us/index.php -o tmp.txt
curl -o tmp.jpg `egrep -o "http:[^']+\.jpg" tmp.txt`
fbsetbg tmp.jpg
thanks repz
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need a shell script to select a random image frieza Linux - General 1 05-14-2008 05:04 AM
howto: Perl CGI, image with random scewed text for accoutn creations exodist Programming 2 03-13-2007 07:36 PM
KDE Random wallpaper or script to create symbolic links to random files cvelasquez Linux - Software 2 02-26-2007 07:48 PM
random image with gtk chirita Programming 1 08-29-2003 09:32 PM
Random Image Thread [pic] bkeating General 24 06-24-2002 11:33 PM


All times are GMT -5. The time now is 03:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration