diff --git a/base/path.jl b/base/path.jl index 231f772923eee..b0b6c52b8903f 100644 --- a/base/path.jl +++ b/base/path.jl @@ -165,10 +165,17 @@ See also: [`basename`](@ref) Get the file name part of a path. +!!! note + This function differs slightly from the Unix `basename` program, where trailing slashes are ignored, + i.e. `\$ basename /foo/bar/` returns `bar`, whereas `basename` in Julia returns an empty string `""`. + # Examples ```jldoctest julia> basename("/home/myuser/example.jl") "example.jl" + +julia> basename("/home/myuser/") +"" ``` See also: [`dirname`](@ref)