Tracing increments and skipped operands

A developer uses the following Bash fragment to test bookkeeping expressions for a job queue. Treat it as a diagnostic calculation. Bash executes every line shown; a nonzero arithmetic-command status does not stop this run.


Shell
jobs=7
(( first = jobs++ ))
(( second = ++jobs ))
(( accepted = 0 && jobs++ ))
(( jobs *= 3 ))
(( jobs -= first + second ))


Give the final stored values of first, second, accepted, and jobs. Enter each as an exact integer, to zero decimal places. The variables are integer counts; do not report command exit statuses.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Bash Expressions Questions: