Fedora Linux Support Community & Resources Center
  #1  
Old 24th August 2010, 08:54 PM
kurtdriver Online
Registered User
 
Join Date: Jul 2005
Location: Vancouver, Canada
Posts: 1,588
linuxfedorafirefox
extract line from a text file

Hi, I'm pulling my hair out trying to figure this error message out. This little script is supposed to tweet my laptop's IP address, as a cron job, I'm hopeful that it would do so even if it's stolen. This is a variant of one that works, but this doesn't, and I can't see a difference in the curl line of either one.
Code:
#!/bin/bash
user="xxxxxx@xxxxxxxxx"
   pass="xxxxxxxxxxx"
      
wget http://www.whatismyip.org/ 
TWEET=`sed -n 1p index.html`                        
         
             curl --basic --user "$user:$pass" --data-ascii \"status=$TWEET"  "http://twitter.com/statuses/update.json"
             rm -f index.html                                         
exit
This is the error message.

Code:
curl: (6) Could not resolve host: status=66.183.103.67; Cannot allocate memory
{"request":"/statuses/update.json","error":"Client must provide a 'status' parameter with a value."}
Why does curl think the status is the URL?
Reply With Quote
  #2  
Old 24th August 2010, 11:23 PM
recondite Offline
Registered User
 
Join Date: Aug 2010
Posts: 134
windows_xp_2003firefox
Re: extract line from a text file

Why not post the one that works too?

---------- Post added at 02:23 PM CDT ---------- Previous post was at 02:12 PM CDT ----------

There are three types of quote characters: single ('), double ("), and backquote (`) and each is treated differently by the shell. Did you change a quote or two?
__________________
Truthfulness is the main element of character.
Reply With Quote
  #3  
Old 25th August 2010, 12:15 AM
kurtdriver Online
Registered User
 
Join Date: Jul 2005
Location: Vancouver, Canada
Posts: 1,588
linuxfedorafirefox
Re: extract line from a text file

Hi and thanks for you reply, I copied this and modified it accordingly.

Code:
#!/bin/bash
 
 USER="xxxxxx"
   PASS="xxxxxxxx"
   TWEET=$@
   echo "$TWEET"    
      
         curl --basic --user "$USER:$PASS" --data-ascii \ "status=$TWEET"  "http://twitter.com/statuses/update.json"
          
           exit
Unrelated note: how do I change a title? This was for another thread, then I remembered that sed would do it.

Edit: I copied and modified again and it works. So not Solved, but Fixed.

Last edited by kurtdriver; 25th August 2010 at 12:27 AM.
Reply With Quote
  #4  
Old 25th August 2010, 04:28 AM
recondite Offline
Registered User
 
Join Date: Aug 2010
Posts: 134
linuxfedorafirefox
Re: extract line from a text file

Well, for one thing, there is a difference between $USER and $user.

There is also a difference between \" and \ " (note the space in the second case).
__________________
Truthfulness is the main element of character.
Reply With Quote
  #5  
Old 25th August 2010, 04:37 AM
kurtdriver Online
Registered User
 
Join Date: Jul 2005
Location: Vancouver, Canada
Posts: 1,588
linuxfedorafirefox
Re: extract line from a text file

Quote:
Originally Posted by recondite View Post
Well, for one thing, there is a difference between $USER and $user.
Thanks again, but the variables are the same within particular scripts, the two scripts user slightly different ones.
Quote:
Originally Posted by recondite View Post
There is also a difference between \" and \ " (note the space in the second case).
Yeah, I tried it each way in the second and just left it without the space in the first when I posted it.
I do appreciate your efforts. Kurt
Reply With Quote
  #6  
Old 25th August 2010, 05:28 AM
MAmundson Online
Registered User
 
Join Date: Jul 2009
Posts: 4
linuxchrome
Re: extract line from a text file

Would it work if you changed \"status=$TWEET" to \"status=$TWEET\"?
Reply With Quote
  #7  
Old 25th August 2010, 04:22 PM
weitjong Offline
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 946
macossafari
Re: extract line from a text file

I suspect your $TWEET variable has empty value. Have you double checked that by outputting its value by using echo command like in your original version of the script?
__________________
YaoWT - Leave no window unbroken ♪ (^。^) 
Reply With Quote
  #8  
Old 25th August 2010, 10:16 PM
kurtdriver Online
Registered User
 
Join Date: Jul 2005
Location: Vancouver, Canada
Posts: 1,588
linuxfedorafirefox
Re: extract line from a text file

Quote:
Originally Posted by weitjong View Post
I suspect your $TWEET variable has empty value. Have you double checked that by outputting its value by using echo command like in your original version of the script?
I did, those echos were just tests. In the error message in the original post the value of that variable is right there (66.183.103.67). The error message seems to say that curl mistakes the $TWEET as the url, but the line that reads
{"Client must provide a 'status' parameter with a value."} came from twitter I imagine.
Reply With Quote
Reply

Tags
extract, file, line, text

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract metadata from Ogg with command line joe.pelayo Using Fedora 0 21st March 2010 07:37 AM
"enscript --word-wrap" does not wrap line of text file powah Using Fedora 0 10th May 2006 06:44 PM
extract iso file. thnguyen Using Fedora 1 28th August 2005 04:22 AM
how to extract tr.gz file ? SharkSoftware69 Using Fedora 5 17th September 2004 05:56 PM


Current GMT-time: 21:33 (Friday, 31-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Guara Photos on Instagram - Chilaw - Asenovgrad Instagram Photos