· About 1 minutes read · Programming Bash

Setting post language using franc and frontmatter

This was handy:

for a in *.md; do
    lang=$(cat $a | franc);
    if [ "$lang" = "eng" ]; then
        frontmatter set $a language en
    else
        frontmatter set $a language is
    fi
done;