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

Re: variable expansion which will remove a file extension



On Mar 17, 11:52pm, zzapper wrote:
}
} How do I write a variable expansion which will remove a file extension eg 
} fred.tex -> fred

	${var:r}


13.1.4 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'.

r
     Remove a filename extension of the form `.XXX', leaving the root
     name.

e
     Remove all but the extension.

t
     Remove all leading pathname components, leaving the tail.  This
     works like `basename'.



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