Hands-on task
Filename without extension
Write a script /root/strip.sh that, from a given path, prints the filename without the directory and without the last extension. For example /tmp/data.csv → data, /a/b/report.final.txt → report.final. A name without an extension is printed as is; the dot at the start of a hidden file's name is not an extension: /home/u/.bashrc → .bashrc.
- bash
- parameter substitution
- ${##}
- ${%}
- path handling