Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Getting a particular char
- X-seq: zsh-users 7805
- From: Sean Johnston <sean.johnston@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: RE: Getting a particular char
- Date: Fri, 6 Aug 2004 12:24:41 +0100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
From: DervishD [mailto:raul@xxxxxxxxxxxx]
Sent: 06 August 2004 11:56
> So I'm implementing it like that:
>
> # Dirty and ugly hack, needs some polishing...
> # First we get rid of all characters at the beginning
> while [ ${#parameter} -gt n ]
> do
> parameter=${parameter#?}
> done
>
> # Now, get rid of the characters after
> # the one we are interested in
>
> while [ ${#parameter} -gt 1 ]
> do
> parameter=${parameter%?}
> done
>
> I would like another ideas, shorter, faster, or simply less ugly,
> and it must be portable, so no zsh tricks :(( If you could please
> help me... Thanks a lot in advance.
>
How about:
parameter=`echo "$parameter" | cut -cn`
Sean.
_____________________________________________________________________
This message has been checked for all known viruses by Xenicom delivered through the MessageLabs Virus Control Centre.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author