Sunday, May 21, 2017

Cron: Copying all Labels from Blog to a File (Example)

Command:

$ cat smashingtheory_label_urls.sh


Result:

if [ $# -eq 1 ]; then
curl -s https://smashingtheory.blogspot.jp | sed -n "s/.*dir='ltr' href='https:\/\/smashingtheory.blogspot.jp\/search\/label\/\\([^']*\\).*/\1/p" > $1
else
echo "Usage: smashingtheory_label_urls.sh FILENAME" >&2
fi


Note:

Double backslashes before the round brackets should be single backslash. I did this to escape Mathjax's behavior.