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 10045
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: variable expansion which will remove a file extension
- Date: Sat, 18 Mar 2006 00:43:55 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns9789F2DC127DFzzappergmailcom@xxxxxxxxxxx> <060317162338.ZM18794@xxxxxxxxxxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote in
news:060317162338.ZM18794@xxxxxxxxxxxxxxxxxxxxxx: 
> ----------------
> 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'.
#!zsh
# test script
fred='/bin/path/fred.txt'
echo ${fred:e}
echo ${fred:t}
echo ${fred:r}
echo ${fred:h}
echo ${fred:h:h}
echo ${fred:t:r}
-- 
http://successtheory.com/ 100 FREE Success and Self-Improvement Tips
Messages sorted by:
Reverse Date,
Date,
Thread,
Author