Skip to content

Instantly share code, notes, and snippets.

@planeth44
Created November 25, 2022 16:02
Show Gist options
  • Select an option

  • Save planeth44/7b9abdd91dc2a19e5ae84c04860d53ef to your computer and use it in GitHub Desktop.

Select an option

Save planeth44/7b9abdd91dc2a19e5ae84c04860d53ef to your computer and use it in GitHub Desktop.
webmention bash script
#!/bin/bash
# from https://indieweb.org/webmention-implementation-guide#One-liner_webmentions
echo -n "Enter your source url: "
read source
echo -n "Enter your target url: "
read target
# echo "$(tput setaf 1)Shirt red $(tput setaf 4) Pant blue"
echo ""
echo ""
echo -n "$(tput setaf 1)source is: $(tput setaf 4)$source"
echo ""
echo -n "$(tput setaf 1)target is: $(tput setaf 4)$target"
echo ""
echo ""
echo -e "\e[1;37;46mAll is good ?[Y or O]\e[0m"
read OK
if [ "$OK" == "Y" || "$OK" == "O" ]
then
curl -i -d "source=$source&target=$target" `curl -i -s $target | grep 'rel="webmention"' | sed 's/rel="webmention"//' | grep -o -E 'https?://[^ ">]+' | sort | uniq`
echo "DONE"
else
echo "ABORT"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment