~/ learn/ comp-325/ cards/ Because every variable is a string
1 of 10

The counter, written both ways

The counter, written both ways

Answer

i=1 i=`expr $i + 1` echo $i i=$((i + 1)) echo $i

Both print an incremented value — 2 then 3. The second line starts a process to do it; the fourth does not.

S&K 3e ch13 §13.2; arithmetic expansion from POSIX.1-2024 §2.6.4

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/bdc0a3f5-056a-4ce8-b860-5e01a8c37eb6/flashcard utf-8 LF