GNU bug report logs - #59819
Bug Report: [coreutils] echo command interprets wildcards, when read with the 'cat' command from a file, in a for-in loop

Previous Next

Package: coreutils;

Reported by: th3_d0ctor <th3d0ctor <at> gmx.de>

Date: Sun, 4 Dec 2022 16:54:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 59819 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: th3_d0ctor <th3d0ctor <at> gmx.de>
Cc: 59819 <at> debbugs.gnu.org
Subject: Re: bug#59819: Bug Report: [coreutils] echo command interprets
 wildcards, when read with the 'cat' command from a file, in a for-in loop
Date: Sun, 04 Dec 2022 18:55:07 +0100
On Dez 04 2022, th3_d0ctor wrote:

> $ echo "*" >b; for i in `cat b`; do echo "$i"; done
> ==> list current working directory instead of printing the wildcard '*'

That's how it is supposed to work, since file name expansion is
performed after all other expansions (just before quote removal).

This is basic shell operation knowledge that everyone using the shell
should remember.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




This bug report was last modified 2 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.