From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15123 invoked by alias); 13 Oct 2015 02:29:16 -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: 20746 Received: (qmail 15371 invoked from network); 13 Oct 2015 02:29:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=1OfWGpG6h1Fvb+UiQQi5JXHnFmSuIuV7KOWfyGUwKXE=; b=kdd6RHeB0PTdZgcT1zlO0dku9FJwHNXuLeGRwCLTlEbseHhqM0VkjGt34OTBEXQQis MRUbdy8lXOxP25xVk1OvrO6eAO4xEn3Cnbk4/DaWH6vWZXz6EidKd61dJULXSOxtIKHX YiGd7s3ifhl3OISpDQLt9P/a8xdAEuxC1+glA6oIpJof2OjgdaOCeO/fMjLArIHW7yzJ npjsEeKmCzXYrX1nEKRCqHDxAWdmMW/ckC1ufw1Krzf21lNyatb3DqBNvlwLgcIstfrM dPXyYfG8hUCer1Tj7igoIDHVsF/bP/y0azxSqg2TvmjExXqf/6aDRz8GJ4uvkuYOxtiH O25Q== X-Gm-Message-State: ALoCoQn7bcYTkQsDC6QEjwBdeljoSMGLPDr1lhZ8hNZhHu1CtPzN8/3YbDndRwEQZfnNMWKKXkqu X-Received: by 10.60.98.8 with SMTP id ee8mr4381461oeb.70.1444703351633; Mon, 12 Oct 2015 19:29:11 -0700 (PDT) From: Bart Schaefer Message-Id: <151012192908.ZM15508@torch.brasslantern.com> Date: Mon, 12 Oct 2015 19:29:08 -0700 In-Reply-To: <561BE8DC.7060506@eastlink.ca> Comments: In reply to Ray Andrews "Re: subsitutions and beginning of lines." (Oct 12, 10:07am) References: <561AB49A.4060801@eastlink.ca> <20151011210902.566de251@ntlworld.com> <561AEB2F.8030808@eastlink.ca> <20151012103455.5f6159d7@pwslap01u.europe.root.pri> <561BD55C.3080006@eastlink.ca> <561BE8DC.7060506@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: subsitutions and beginning of lines. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 12, 10:07am, Ray Andrews wrote: } } ... Each search parameter is colorized incrementally. (I add the minus } sign automatically) It now strips off the leading stuff as we've } discussed. Code as I have it now is: } } OLDIFS=$IFS } IFS=$'\n' var=($(eval history $nnumber $sstring)) } } echo "${(F)var[@]//#???????/}" } IFS=$OLDIFS } } So, the 'eval'ed expression ends up like: } } 'history -100 | grep --color=always to | grep --color=always 'a date' | ... ' If you're using "grep" to do the colorizing, there's no point in using the $history variable to get the history entries, because you need them to end up on stdout for passing through grep anyway. (Generic advice to anyone reading this: Asking about one small piece of a larger problem is quite likely to get you an inappropriate solution. Context is important.) } the outputno longer lines up because double spaces become single } spaces whereas double spaces are needed for the brutal ' //#???????/' } substitution to work properly. Why not simply use "history -n" so the numbers are omitted in the first place? Then you don't need to assign to var=(...) and apply //#.../. That whole chunk of code just reduces to eval history -n $nnumber $sstring and you're done.