Offline Microblog
---
Download
(SH, 65.6 KiB)
Current version: 9.4-1 2025-12-12
About
This script creates and manages a Markdown-formatted "timeline" microjournal file.
Usage:
microblog.sh [OPTIONS] TIMELINE_FILE [-m TIMELINE_FILE]
Features:
- Full POSIX.1-2008 compliance
- No non-POSIX dependencies
- All timeline operations are atomic
- Post deletion
- Attachment support
- Reply support, including forward replies
- Draft saving and loading, including attachments
- twtxt cross-posting support
- Merge diverging timeline files
- Calculate post statistics
- Unique user ID and custom username
- Per-timeline configuration options
- Optionally override timeline configuration at runtime
- POSIX- and GNU-style options supported
- All dependencies checked at runtime
- Post length limits
- Use editor of choice to write posts
- Avatar support
- Default avatar generation (requires bc)
- ISO 8601 date and time on all posts
- UUID on all posts
- Optionally create twtxt file during timeline creation
- Atomic post read-back
- Up to 100 attachments per post
- Attachment deduplication
- Add posts from STDIN
- Pager support
- Optionally write post UUIDs as Base64
Attachments are stored in an 'attachments' directory in the same location as the timeline file. Drafts are similary stored in a directory called 'drafts'. A '.working' directory is used for internal files.
I consider this script functionally complete for my original purpose, but I may tweak it or add features over time.
Notes
- Hard dependencies are 'awk', 'cat', 'cksum', 'cp', 'date', 'dd', 'expr', 'find', 'mkdir', 'mv', 'printf', 'read', 'rm', 'sed', 'sort', 'test', 'tr' and 'wc'.
- Optional dependencies are 'bc', 'fold', 'more', 'od', 'sleep', 'uniq' and 'uuencode'. Some functions also optionally use 'date' with the non-POSIX "%z" (numerical timezone) format string. Dependent functions are automatically disabled if their dependencies are not found.
- The script sets $IFS to only newlines. Upon most types of termination signal, IFS will be restored to its original value (or unset). Confirm $IFS has the value you expect after running.
- twtxt cross-posting writes to a twtxt file in the same directory as the timeline file. To post to twtxt seamlessly, create a symlink from this file to your twtxt file.
- Attachments are deduplicated using 'cksum'. If two attachments have the same CRC value and file size, they will be marked as duplicates, even if their contents differ.
- When merging two timelines, if one copy of a post has a compressed post ID and the other has an uncompressed ID, they will be flagged as different posts, even if both IDs correspond to the same value.
- If a locale is not set (such as on non-POSIX systems), the script assumes ASCII and uses hard-coded character ranges.
- Abbreviated GNU-style options are not supported.
- Paths containing newlines are not supported.
- Attachments with file extensions that contain non-alphanumeric characters may cause unexpected behavior.
---
[Last updated: 2025-12-11]