~/ learn/ comp-325/ cards/ Bourne Shell Programming II: Arithmetic, Here Documents, trap, exec, Functions
1 of 47

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/2502b8d8-2ee3-4b2d-a467-957b578253b4/flashcard utf-8 LF