Count processed records

A Bash batch routine increments its attempt counter before deciding whether to process a record. Assume automatic exit on an unsuccessful command is disabled. What is the final value of processed, in records, after this snippet finishes? Enter an integer with zero decimal places.


Shell
attempts=0
processed=0
until (( attempts >= 5 )); do
  (( attempts += 1 ))
  if (( attempts == 2 )); then
    continue
  fi
  (( processed += 1 ))
done

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 Control Structures Questions: