Linux, plaintext & minimalism
November 30, 2018

How to use newlines and quotes with toot

I post a lot of updates to Mastodon using the CLI-client toot. And one thing that can be tricky to figure out is how to post content with newlines and quotes.

For a regular post you just use toot like this:

toot post "Example content."

But if you want to use newlines and quotes, you need echo the content with the flag -e, which enables interpretation of backslash escapes.

You can then add a newline using \n like this:

echo -e "First line\nSecond line" | toot post

And if you want to use a quotes, you just need to escape the characters like this:

echo -e "\"Example quote.\"" | toot post
Tags: toot | Mastodon


I don't have a commenting system simply because I haven't found a solution that I like. If you want to leave any feedback and/or have any questions feel free to contact me either via e-mail, the fediverse, by XMPP or by IRC (I'm Hund at freenode.net).