Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: /non/existant/path(:h)



Sebastian Stark <seb-zsh@xxxxxxxxxxx>:
[...]
> I say this is not exactly true since if you expand:
>
>  $myvar(:h)
>
> when myvar contains a path that does not exist it will expand to the  
> empty string if nullglob is set or, if nullglob is unset, it will lead  
> to an error. This is not very close to a replacement of dirname(1), like 
> suggested by the manpage.

[snip]
% foo=/foo/bar/baz.txt
% print ${foo:h}
/foo/bar
[snap]

In the $foo(:h) case, :h is a globbing modifier, which works a bit
differently, if the file does not exist.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



Messages sorted by: Reverse Date, Date, Thread, Author