Advertisement
tonybaldwin

friendicurl

Jun 29th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # update friendika from bash with curl
  4. # I put this in my path as "friendicurl"
  5. # usage would be "friendicurl some text for update"
  6.  
  7. # here you enter your username and password
  8. # you could simply assign these variables
  9. # even in the curl command below, and skip this step.
  10. # If I weren't lazy, I would also make it so you could have a .friendicurl config file
  11. # to contain this data, I suppose...
  12.  
  13. read -p "username: " uname
  14. read -p "password:  " pwrd
  15.  
  16. # if you did not enter text for update, the script asks for it
  17.  
  18. if [[ $(echo $*) ]]; then
  19.     ud="$*"
  20. else
  21.     read -p "Enter your update text: " ud
  22. fi
  23.  
  24. # and this is the curl command that sends the update to the server
  25.  
  26. if [[ $(curl -u $uname:$pwrd -d status="$ud" http://friendika.openmindspace.org/api/statuses/update.xml | grep error) ]]; then
  27.  
  28. # what does the server say?
  29.  
  30.     echo "Error"
  31. else
  32.     echo "Success!"
  33.     echo $ud
  34. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement