On Tue, Mar 31, 2015 at 06:04:53PM +0300, Filimonov Vadim wrote:
filimonov@filimonov:~/bashbug/bash-4.3$ read -u63 LINE <(echo "*")
bash: read: `/dev/fd/63': not a valid identifierYou are missing a < sign here. You probably wanted:
read LINE < <(echo "*")
It is not safe to assume that the <() will produce a reference to file
descriptor 63. On many platforms, it won't even use /dev/fd/ at all,
but will instead use a named pipe.
Your command expands to
read -u63 LINE /dev/fd/63
Which produces the error message, as it tries to treat /dev/fd/63 as
a variable name to assign into. However, before it runs into that
error, it has already read a "*" character from file descriptor 63
(since you told it to do that with -u63). And that * character is now
in the variable named LINE.... ;echo $LINE
ABOUT-NLS aclocal.m4 alias.c alias.h alias.o array.c arrayfunc.c arrayfunc.h arrayfunc.o array.h array.o assoc.c assoc.h assoc.o AUTHORS bash bashansi.h bashbug bashhist.c bashhist.h bashhist.o bashintl.h bashjmpYou always want echo "$LINE" and *never* echo $LINE.
http://mywiki.wooledge.org/BashPitfalls#pf14
The * from $LINE was expanded because you failed to quote properly.
Hello, Greg!
Thank you. It's really my mistake, sorry.
Good explanation.
But I can't understand why
echo *
prints listing of directory?
31.03.2015, 19:06, "Greg Wooledge" <wool...@eeg.ccf.org>:
- read unexpected reads directory list Filimonov Vadim
- Re: read unexpected reads directory lis... Greg Wooledge
- Re: read unexpected reads directory... Filimonov Vadim
- Re: read unexpected reads direc... Eduardo A . Bustamante López
- Re: read unexpected reads directory lis... Eduardo A . Bustamante López
- Re: read unexpected reads directory... Filimonov Vadim