From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23400 invoked by alias); 5 Feb 2015 01:53:08 -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: 19818 Received: (qmail 25233 invoked from network); 5 Feb 2015 01:52:54 -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=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=KATcYXd5GSjDu895ubdv2vnSgNERBb2F56ws7e7sJCs=; b=OM0bKp+YVSsf9DsV3MwHBwIJudovGGgOk7Jkdiz66WhNIMimvEWxG9gcS11suNokS9 XAnMRUBVGb1o2PwSQZKuB1FEuknYZpjmvKb/+mjmB5XWFQXUVDeGsHaAUL1mV7bWHkQs 1d5vK/SBA6WH8sjkVjtOdagvikQoVu+zBJHhaRq9HWLEixcuElyjJfUXrAxp8y3Xs3F3 l2B01KKHBZUGU0XA7soBkQnPC+kFVUleoYpDEf0hx22zWN+qxeyuYDuYVkUuxD4dYxMX 22IaAxT5wSI9s1We0WHiTzFJzrjbI7FDLcJ4IDOc1RX9KUkoKGcDAX1HR/srq3Nsh6Dk puiA== X-Gm-Message-State: ALoCoQnz4ZjTKpHa0W3P8SdosRRpPU8cJKjLol6IzPYkV//DvHOyhJVk6eCsSVItuCDGm3jEI464 MIME-Version: 1.0 X-Received: by 10.112.148.73 with SMTP id tq9mr1048189lbb.37.1423101170911; Wed, 04 Feb 2015 17:52:50 -0800 (PST) In-Reply-To: <54D2C805.9020906@eastlink.ca> References: <54D155C8.4080600@eastlink.ca> <412544FB-49A2-43AA-BC76-DC1AF1AA71BE@larryv.me> <54D16A4C.9010609@eastlink.ca> <150203192508.ZM2159@torch.brasslantern.com> <54D195B2.4070205@gmx.com> <150204091014.ZM3216@torch.brasslantern.com> <54D25A02.1000605@eastlink.ca> <260A930A-CA77-4BDB-8827-047F742FD3CF@larryv.me> <54D2C805.9020906@eastlink.ca> Date: Wed, 4 Feb 2015 17:52:50 -0800 Message-ID: Subject: Re: The "-" and "--" options (was Re: ${var:1:1:=y}) From: Kurtis Rader To: Ray Andrews Cc: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= , Zsh Users Content-Type: multipart/alternative; boundary=047d7bf0f65ec5a677050e4d8f11 --047d7bf0f65ec5a677050e4d8f11 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Feb 4, 2015 at 5:31 PM, Ray Andrews wrote: > On 02/04/2015 03:47 PM, Lawrence Vel=C3=A1zquez wrote: > >> % echo - - >> > Ok, the first hyphen gets eaten, and the next one is literal. Still, > shouldn't > single quotes make anything inside them literal? > The single-quotes simply inhibit the shell from performing any substitutions (e.g., of $var references) inside the quoted string. The quotes also inhibit splitting the string on $IFS boundaries; i.e., the shell will pass the resulting string as a single argument to the command. The echo command simply gets a hyphen whether or not you quoted it. The echo command has no way of knowing that it was originally enclosed in single-quotes. Ignore for the moment that echo might be a shell builtin. Assume it isn't and the shell has to search $PATH and invoke the first external command of that name it finds. You certainly don't want the shell to pass '-' to /bin/echo. If that was done then every external command would need to implement the same string parsing that the shell already does. And that way lie madness. In fact, Microsoft Windows works that way. Or at least it did back in the MS-DOS through Win98 releases. External commands got a single string representing all the arguments and it was up to the command to split the string into tokens and handle any quoting. Ugh! --=20 Kurtis Rader Caretaker of the exceptional canines Junior and Hank --047d7bf0f65ec5a677050e4d8f11--