Q:

bc arithmetic error

I am following this guide to try and setup a lemonbar config: http://blog.z3bra.org/2014/04/meeting-at-the-bar.html
Now almost everything works flawlessly except for this line:
bc <<< "scale=2; 100 - $f / $t * 100" | cut -d. -f1

In this function:
memused() {
    read t f <<< `grep -E 'Mem(Total|Free)' /proc/meminfo |awk '{print $2}'`
    bc <<< "scale=2; 100 - $f / $t * 100" | cut -d. -f1
}

I get the following error (standard_in) 1: syntax error
Now from what I can tell I should be adding double brackets around the equation (()) but I have tried a ton of different arrangements and nothing fixes the error.

A:

awk can do all of read's, cut's, grep's and bc's jobs here:
 awk -F': *' '
   $1 == "MemTotal" {t = $2}
   $1 == "MemFree" {f = $2}
   END {printf "%.1f%%\n", (t - f) * 100 / t}' /proc/meminfo

Beware that not all awk implementations will output 40,5% instead of 40.5 in locales where comma is used as the decimal radix (GNU awk only does it in POSIX mode like when $POSIXLY_CORRECT is in the environment). Use LC_ALL=C awk... to force the decimal radix to period/dot.
Change %.1f to %.0f if you don't want a decimal part at all. That will round to the nearest integer. Use %d instead if you want to truncate the decimal part (get 99% instead of 100% for 99.999).
Your read t f <<< `grep -E 'Mem(Total|Free)' /proc/meminfo |awk '{print $2}'` would have worked in older versions of bash assuming an unmodified $IFS.
In cmd <<< `code`, bash used to split the output of code on characters of $IFS (which by default includes newline) and join them with the first character of $IFS (by default space) before feeding as stdin to the command. So in your case, those two lines of awk's output would end-up being fed as two words on one line as expected by read t f. That surprising behaviour (and also differing from the original implementation in zsh) was fixed in bash-4.4.
In bash-4.4 and above, you'd need { read t; read f; } <<< "$(awk...)" (here adding quotes around $(...) so it also works in bash-4.3 and before, still assuming the default value of $IFS).

