help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quote interpretation via vars without eval


From: Greg Wooledge
Subject: Re: quote interpretation via vars without eval
Date: Mon, 15 Mar 2021 14:49:52 -0400

On Mon, Mar 15, 2021 at 07:33:07PM +0100, Alex fxmbsw7 Ratchev wrote:
> cd /tmp ; >$'\1' ; find $'\1'
> ./?

One: you didn't check the result of cd.  But I guess this is just being
done in an interactive shell, not a script, so OK.

Two: your output does not match the command you gave.

unicorn:~/tmp$ touch $'\1'; find $'\1'
?

There is no leading ./ in the output, at least with my particular version
of GNU find.  Maybe yours is vastly different, but it's more likely that
you didn't paste an actual command-and-output pair, but instead, decided
to fake it.  Please don't do that.  It isn't helpful.

Three: GNU find is trying to protect you by changing the output when
the output is going to a terminal.

unicorn:~/tmp$ touch $'\1'; find $'\1' | od -tx1 -An
 01 0a
unicorn:~/tmp$ touch $'\1'; find $'\1' | cat

unicorn:~/tmp$ 

The ? output is no longer shown, because find's output isn't going to
a terminal.

> ls displays it as
> ''$'\001'

ls's output is notoriously useless.  We have a whole wiki page on this
topic.  You know this.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]