Tony's Wiki | bash

a script to update your Friendica from the command line.

the code

# update friendica with bash, vim and curl
# I put this in my path as ""
# by tony baldwn,
# on friendica at
# released according to the Gnu Public License, v.3
# first, create a post/update
filedate=$(date +%m%d%y%H%M%S)
# if you did not enter text for update, the script asks for it
if [[ $(echo $*) ]]; then
# Yes. You could use "emacs", "nano", "joe", "pico", or $EDITOR, 
# or, even, a gui editor, if you prefer (but why? it's a CLI tool), 
# but why bother yourself with inferior editors?
	vim $filedate.fpost
	ud=$(cat $filedate.fpost)
read -p "enter a title: " title
# now to see if you want to crosspost elsewhere
echo "For the following question regarding crossposting, please enter the number 1 for yes, and 0 for no."
echo "If your friendica has the plugins, and you've configured them, you can crosspost to other blogs and sites."
echo "friendica will even automatically change the bbcode to proper html for you."
echo "would you like to crosspost to "
read -p "statusnet? " snet
read -p "twitter? " twit
read -p "facebook? " fb
read -p "dreamwidth?  " dw
read -p "livejournal? " lj
read -p "tumblr? " tum
read -p "posterous? " pos
read -p "wordpress? " wp 
read -p "libertree? " lt 
# now to authenticate
read -p "Please enter your username: " uname
read -p -s "Please enter your password: " pwrd
read -p "Enter the domain of your Friendica site (i.e. " url
# and this is the curl command that sends the update to the server
if [[ $(curl --ssl -u $uname:$pwrd  \\ 
-d "status=$ud&title=$title&ljpost_enable=$lj&posterous_enable=$pos&dwpost_enable=$dw&wppost_enable=$wp&tumblr_enable=$tum&facebook_enable=$fb&twitter_enable=$twit&statusnet_enable=$snet&libertree_enable=$lt&"  \\ 
$url/api/statuses/update.xml | grep error) ]]; then
# what does the server say?
	echo "Error"
	echo "Success!"
	echo $ud

How it works

Okay, now, you can enter text for short updates, or, if you do not, the script will call vim to allow you to write a longer post, then send it. (One could change that to nano or emacs or somet other inferior editor, but, why?). The script also asks for your preferences regarding cross-posting to, twitter, and facebook, and then applies them. some short update here 

sends “some short update here” to friendica.

will prompt the user for text, then post what you write there. If you don't want to use vim, replace “vim” in the script with your preferred editor (you know, like that Esc Mod Alt Ctrl Shift thingy, or something).


Please note that I force use of SSL with the “–ssl” option in the curl command. This is necessary at, the friendica site I admin, but may not be so on all friendica sites, and can be disabled by removing the “–ssl”, of course.


Now, if you are looking for a gui application, that will even help you with inserting bbcode, etc., try FrenTcl.



My friendica:

tonybaldwin 2012.

Tony's Wiki | bash | friendicurl talk