Hands-on task
This task is step 6 of the course “Bash scripts: from a loop to a robust script”
Split a path into name and directory
The file /root/path.txt contains the full path to a file. Extract the file name (the last component) into /root/name.txt and the directory (everything before the name) into /root/dir.txt.
What you'll practise:
- basename
- dirname
- path parsing
- command substitution
- paths