Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: variable expansion which will remove a file extension
- X-seq: zsh-users 10042
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: variable expansion which will remove a file extension
- Date: Fri, 17 Mar 2006 16:23:38 -0800
- In-reply-to: <Xns9789F2DC127DFzzappergmailcom@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9789F2DC127DFzzappergmailcom@xxxxxxxxxxx>
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