Results 1 to 10 of 20
Wonderin if any1 noe hw 2 execute curl command using a script ???
The command i have here is
news= " www.yahoo.com.sg"
echo curl news | grep "something" | head ...
- 11-09-2007 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
executing a Curl command using a script
Wonderin if any1 noe hw 2 execute curl command using a script ???
The command i have here is
news= " www.yahoo.com.sg"
echo curl news | grep "something" | head "something > data.txt
but i encounter error like unbound variable
Can any1 help me Desperately need help =D
- 11-09-2007 #2
First of all. can you please try to not use things like any1 or noe.
Some people here might have trouble reading that.
And to answer your question:
But Id put it in the commands so you wont have to chance to script everytime you run it for something like this:Code:#!/bin/bash news= "www.yahoo.com.sg" $grepwhat="something" echo curl $news | grep $grepwhat | head $grepwhat > data
Here is the first argv you give the address you want to curl.Code:#!/bin/bash echo curl $1 | grep $2 | head $2 > $3
the second what you want to grep
and the thirt what file it has to be put in.
Hope that helped.
- 11-09-2007 #3Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
- 11-09-2007 #4
- 11-09-2007 #5Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
- 11-09-2007 #6
- 11-09-2007 #7Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
- 11-09-2007 #8
- 11-10-2007 #9Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
oh.. thx guys
- 11-12-2007 #10Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
#!/bin/bash
#code.h
shopt -s -o nounset
news=" Channelnewsasia.com - Singapore News "
grep header ="haha"
echo curl $news | grep $header | head -3 | sed 's/<[^<>]*>//g' |tail -1 > $data
exit
Need help guys, this is the code im doing on, but after doing the steps given by u guys, i cant the answer i want...how come?


Reply With Quote
