One liner for posting a mastodon status from command-line (you need to get a token from preferences/development and put it in a file called `token`):

curl -H "Authorization: Bearer $(cat token)" --verbose -F status="I like cheese"

@benc That’s one status I may as well leave on an infinite loop.

@benc I was intrigued so I created a little bash script that will open up your editor and let you compose the message:

@hund @benc you should feel free to rename it to that that if you want!

@hund @edsu for my original post, because I want to talk about the API a bit in a talk i'm giving, and this just popped out as "huh, this is neat" on the way to that...

@benc That method is insecure by virtue of putting secrets on the command line. You should instead put the whole header line in a file and use the "-H @..." form.

@ThijsLambrecht you can define an environment variable $FOOD for more general use cases

Sign in to participate in the conversation
benc's personal instance

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!