Sample Header Ad - 728x90

Is it "safe" to replace each occurrence of (possibly overlapped) `/./` with `/` in a path?

8 votes
2 answers
558 views
In POSIX compliant systems, is a path whose occurrences of (possibly overlapped) /./ have been substituted with / guaranteed to lead to the same target as the original one? Example:
#!/bin/bash

shopt -s extglob

some_command -- "${@//\/+(.\/)//}"
--- #### UPDATE: Given the comments, it is not equivalent, so I'll update the question: In POSIX compliant systems, is a path for which the occurrences of (possibly overlapped) /././ have been replaced with /./ guaranteed to lead to the same target as the original path?
Asked by Fravadona (1581 rep)
Sep 16, 2022, 08:57 AM
Last activity: Jan 17, 2025, 06:50 AM