2019-06-05 12:01:33 -0700, Jefferson Carpenter:
> Unlike path separation via basename and dirname, there is no
> utility to concatenate paths.  The naive bash implementation:
> 
> 
> 
>     "${basename}/${dirname}"
> 
> 
> 
> is not correct in the case that the basename is "//" (// ->
> ///), OR if basename is "/" and dirname does not begin with a
> slash (/ -> //). 
> (see 
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271:
> "Multiple successive <slash> characters are considered to be
> the same as one <slash>, except for the case of exactly two
> leading <slash> characters.")
[...]

Is ${dirname%/}/$basename not enough? (here reversing dirname
and basename so they have their more usual meaning).

-- 
Stephane

Reply via email to