Path Parts
Easy · Variables & Expansion · Parameter expansion
Problem
A path such as /var/log/system.log arrives as the first argument.
Print the filename on the first line, and the filename without its extension on the second — using parameter expansion, not basename.
Examples
Input: /var/log/system.log Output: system.log system
Approaches
- ## then %
Related problems
Start free on Cariara · Coding problems · System design studio