Multiple choice technology operating systems

filename=sample.txt file=\${filename%.*} echo \$file \$file now contains

  1. txt

  2. sample

  3. .txt

  4. sample.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The parameter expansion ${filename%.} removes the shortest suffix matching ., stripping the extension. So sample.txt becomes sample, not just the extension or with a trailing dot.