jb55 on Nostr: nostr-post, a [nostril]() script to make a post with your EDITOR ```bash ...
nostr-post, a [nostril](
https://github.com/jb55/nostril) script to make a post with your EDITOR
```bash
#!/usr/bin/env bash
set -e
TMP=$(mktemp)
$EDITOR "$TMP"
if [ ! -f "$TMP" ]; then
printf "could not create temporary file\n" >&2
exit 1
fi
content="$(cat $TMP)"
re="^[[:space:]]*$"
if [[ "$content" =~ $re ]]; then
printf "note empty. aborting.\n" >&2
exit 2
fi
note=$(nostril "$@" --content "$content")
printf "relaying:\n" >&2
printf "$note\n"
<<<"$note" nostr-relay-note
printf "done.\n" >&2
rm -f "$TMP"
```
Published at
2022-04-24 15:18:38Event JSON
{
"id": "8ff97cd42281221fcdcdec63b4f83ec05c24e6b8944fd471d17362d530c8cd3e",
"pubkey": "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245",
"created_at": 1650813518,
"kind": 1,
"tags": [
[
"e",
"ebf6c6ece7f1db64bd6780776433723e6c8a1a1271745e0ed66dabc7630b3878"
]
],
"content": "nostr-post, a [nostril](https://github.com/jb55/nostril) script to make a post with your EDITOR\n\n```bash\n#!/usr/bin/env bash\n\nset -e\n\nTMP=$(mktemp)\n\n$EDITOR \"$TMP\"\n\nif [ ! -f \"$TMP\" ]; then\n\tprintf \"could not create temporary file\\n\" \u003e\u00262\n\texit 1\nfi\n\ncontent=\"$(cat $TMP)\"\n\nre=\"^[[:space:]]*$\" \nif [[ \"$content\" =~ $re ]]; then\n\tprintf \"note empty. aborting.\\n\" \u003e\u00262\n\texit 2\nfi\n\nnote=$(nostril \"$@\" --content \"$content\")\n\nprintf \"relaying:\\n\" \u003e\u00262\nprintf \"$note\\n\"\n\u003c\u003c\u003c\"$note\" nostr-relay-note\nprintf \"done.\\n\" \u003e\u00262\n\nrm -f \"$TMP\"\n```",
"sig": "4ea6d891174b426ef833caf5f3ec95aa5d4abd017dca6f3a3d889e32db73304ce2531e5322f80928d7ac065de849418748c5dc27ba6c4e0d1af9277d45723ba1"
}