zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <vq@larryv.me>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: The "-" and "--" options (was Re: ${var:1:1:=y})
Date: Wed, 4 Feb 2015 18:47:17 -0500	[thread overview]
Message-ID: <260A930A-CA77-4BDB-8827-047F742FD3CF@larryv.me> (raw)
In-Reply-To: <54D25A02.1000605@eastlink.ca>

On Feb 4, 2015, at 12:42 PM, Ray Andrews <rayandrews@eastlink.ca> wrote:

> I'm glad I've been disabused of any notion that consistency is something
> to be expected or even valued.

As others have opined, expecting "consistency" from any echo(1) is a bad
bet, and there are reasons why zsh's echo doesn't work the way you want
it to. Use printf(1).

> Anyway it seems that this makes it difficult to echo a dash.  I'd have
> guessed that single quoting the dash would work, but no luck, however:
> 
>    $ echo '- '
> 
> works, so that will do.

It "works" because the argument is actually a hyphen followed by
a space. That's why echo doesn't treat it specially. Use this to
print a hyphen:

    % echo - -

Or, again, use printf(1) if you're concerned at all about portability.

vq


  reply	other threads:[~2015-02-04 23:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 23:12 ${var:1:1:=y} Ray Andrews
2015-02-04  0:18 ` ${var:1:1:=y} Lawrence Velázquez
2015-02-04  0:39   ` ${var:1:1:=y} Ray Andrews
2015-02-04  1:30     ` ${var:1:1:=y} Lawrence Velázquez
2015-02-04  3:25       ` ${var:1:1:=y} Bart Schaefer
2015-02-04  3:44         ` ${var:1:1:=y} Eric Cook
2015-02-04 17:10           ` The "-" and "--" options (was Re: ${var:1:1:=y}) Bart Schaefer
2015-02-04 17:42             ` Ray Andrews
2015-02-04 23:47               ` Lawrence Velázquez [this message]
2015-02-05  1:31                 ` Ray Andrews
2015-02-05  1:52                   ` Kurtis Rader
2015-02-05  2:03                     ` Ray Andrews
2015-02-05  2:24               ` Bart Schaefer
2015-02-04 19:02             ` Peter Stephenson
2015-02-04 19:53               ` ZyX
2015-02-04  5:16         ` ${var:1:1:=y} Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=260A930A-CA77-4BDB-8827-047F742FD3CF@larryv.me \
    --to=vq@larryv.me \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).