From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7088 invoked by alias); 20 Mar 2013 20:12:36 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17718 Received: (qmail 26334 invoked from network); 20 Mar 2013 20:12:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at nkuitse.com does not designate permitted sender hosts) Date: Wed, 20 Mar 2013 15:41:02 -0400 From: Paul Hoffman To: zsh-users@zsh.org Subject: Re: truncating string in .zprofile Message-ID: <20130320194102.GB89285@phisen.local> Mail-Followup-To: zsh-users@zsh.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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