Multiple choice technology programming languages

Extract $length characters of substring from $string at $position.

  1. ${string:position:length}
  2. ${string:length:position}
  3. ${string:length-position}
  4. ${string::length::position}
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Bash substring expansion uses the syntax ${parameter:offset:length}. Here, ${string:position:length} correctly extracts length characters starting from the 0-indexed position. The other options are incorrect because they use wrong parameter ordering or invalid syntax separators that will cause shell errors.