Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: truncating string in .zprofile
- X-seq: zsh-users 17718
- From: Paul Hoffman <nkuitse@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: truncating string in .zprofile
- Date: Wed, 20 Mar 2013 15:41:02 -0400
- In-reply-to: <mailbox-13443-1363803840-947330@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>
On Wed, Mar 20, 2013 at 07:28:27PM +0100, Eric Smith wrote:
> I have the following prexec() in my profile;
> preexec () { print -Pn "\033k\033\134\033k[$1]\033\134" }
>
> This prints the command in the screen caption for that window.
>
> What I want to do is limit this window title to n chars.
>
> However, I cannot manipulate the `$1' in the print string.
> Even if I try.
> substring=$1
> preexec () { print -Pn "\033k\033\134\033k[$substring]\033\134" }
>
> then there is no value printed for $substring.
>
> What is the solution?
preexec() {
print -Pn "\033k\033\134\033k["${1[1,30]}"]\033\134"
}
Paul.
--
Paul Hoffman <nkuitse@xxxxxxxxxxx>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author