zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: TJ Luoma <luomat@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: how to either ignore or deal with Icon$'\r' files on macOS
Date: Thu, 20 Jun 2019 18:38:23 -0700	[thread overview]
Message-ID: <CAH+w=7bRNDbxtFieHaXCtR7Lw0n+j_EaUzag4nJk8ECAzLN-BQ@mail.gmail.com> (raw)
In-Reply-To: <CADjGqHt0p7Mohed9Ge80HidT93Q5Mc-DuKdKuzd-vrVGyMmQSQ@mail.gmail.com>

On Thu, Jun 20, 2019 at 5:06 PM TJ Luoma <luomat@gmail.com> wrote:
>
> Icon$'\r'

So, $'\r' is zsh's representation of a carriage return character.
It's very strange that anything would deliberately be using
carriage-return in a file name, but ...

> for i in *
> do
>     if [ "$i" != "Icon$'\r'" ]
>     then
>         echo "$i"
>     fi
> done

$'\r' is already a form of quoting,  just *don't* put it in double-quotes:

for i in *
do
    if [[ "$i" != Icon$'\r' ]]
    then
        # whatever
    fi
done

You should know better by now than to expect echo to faithfully
reproduce things on its output, it does way too much interpretation of
the argument strings.  In this case, however, the trailing
carriage-return is already "invisible" and echo isn't going to do
anything to make it appear.

  parent reply	other threads:[~2019-06-21  1:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21  0:04 TJ Luoma
2019-06-21  1:26 ` Ray Andrews
2019-06-21  1:38 ` Bart Schaefer [this message]
2019-06-21  8:20   ` Roman Perepelitsa

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='CAH+w=7bRNDbxtFieHaXCtR7Lw0n+j_EaUzag4nJk8ECAzLN-BQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=luomat@gmail.com \
    --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).