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

/non/existant/path(:h)




In zshexpn(1) it says:

  Modifiers
After the optional word designator, you can add a sequence of one or more of the following modifiers, each preceded by a `:'. These modifiers also work on the result of filename
      generation and parameter expansion, except where noted.

h Remove a trailing pathname component, leaving the head. This works like `dirname'.

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.

It could be that I missed something, as always. But I think the manpage should be more clear about that. On the other hand it would be nice if :h indeed worked as a replacement for dirname. Not sure if this can be achieved without too much hassle.


Sebastian



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