Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: truncating string in .zprofile
- X-seq: zsh-users 17729
- From: Paul Hoffman <nkuitse@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: truncating string in .zprofile
- Date: Thu, 21 Mar 2013 08:34:09 -0400
- In-reply-to: <mailbox-25186-1363812608-77606@pepper.0.0.200>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <mailbox-13443-1363803840-947330@pepper.0.0.200> <20130320194102.GB89285@phisen.local> <mailbox-7940-1363810632-852297@pepper.0.0.200> <20130320204528.GC89285@phisen.local> <mailbox-25186-1363812608-77606@pepper.0.0.200>
On Wed, Mar 20, 2013 at 09:54:48PM +0100, Eric Smith wrote:
> I did this -
> preexec () { print -Pn
> "\033k\033\134\033k[${1[1,12]}..${1[-6,$]}]\033\134" }
>
> How would I do arbitrary string searching and replacement in the `$1'?
Any way you want -- grep, sed, or plain zsh.
preexec() {
print -Pn "\033k\033\134\033k[$(
print -n 'uptime: '
uptime | perl -pe ...
)]\033\134"
}
Paul.
--
Paul Hoffman <nkuitse@xxxxxxxxxxx>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author