Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1968F431FAF for ; Thu, 20 Mar 2014 03:31:37 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mThNQuwEXpI3 for ; Thu, 20 Mar 2014 03:31:29 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 4603D431FAE for ; Thu, 20 Mar 2014 03:31:29 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id D07FF10009D; Thu, 20 Mar 2014 12:31:24 +0200 (EET) From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH] cli: add a tool for starting new message in the emacs ui In-Reply-To: <877g7pn9bs.fsf@nikula.org> References: <1395257153-29764-1-git-send-email-jani@nikula.org> <877g7pn9bs.fsf@nikula.org> User-Agent: Notmuch/0.17+155~g3416ef5 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Mar 2014 10:31:37 -0000 On Wed, Mar 19 2014, Jani Nikula wrote: > On Wed, 19 Mar 2014, Tomi Ollila wrote: >> On Wed, Mar 19 2014, Jani Nikula wrote: >> >>> + >>> +# Positional parameters. >>> +while [ $# -gt 0 ]; do >>> + ELISP="${ELISP} (message-goto-to) (insert \"${1}, \")" >>> + shift >>> +done >> >> for arg; do > > for arg in $@; ? Yes, that is less obfuscated version of that, whichever you feel more comfortable with... for more discussion about the alternatives here see: http://www.in-ulm.de/~mascheck/various/bourne_args/ (but don't look that -- it is unnecessary and only causes headache ;D) >> maybe arg=${arg//\\/\\\\}; arg=${arg//"/\\"}; >> >> ${parameter/pattern/string} -- Pattern substition in bash manual. > > I'm inclined to go with "don't do that then" ;) $ bash -c 'arg=${0//\\/\\\\}; echo ${arg//\"/\\\"}' 'this"is\a test' this\"is\\a test $ zsh -c 'arg=${0//\\/\\\\}; echo ${arg//\"/\\\"}' 'this"is\a test' this\"is\a test $ ksh -c 'arg=${0//\\/\\\\}; echo ${arg//\"/\\\"}' 'this"is\a test' this\"is\\a test Interestigly zsh on Scientific Linux 6.2 fails here (zsh 4.3.10) -- I tried various tricks and none helped. Hmm also zsh 4.3.17 on Ubuntu 12.04 fails. zsh 5.0.2 on Fedora 20 works OK. ksh & bash installed on all these 3 systems work OK (and also bash 3.2.51... on Mac OS X). IMO this quoting should be done -- so I can send you email with: $ notmuch-emacs-mua '"Jani Nikula" ' Tomi