Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Linda Walsh
Greg Wooledge wrote: On Wed, Apr 02, 2014 at 07:54:58AM +0300, Pierre Gaston wrote: [[ -d $1 ]] && { readarray entries<<<"$(cd "$1" && printf "%s\n" * 2>/dev/null)" ((${#entries[@]} < 3)) && return 0 That's unnecessarily complex. why not simply: entries=("$1"/*) ? Indeed --

Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Chris Down
Linda Walsh writes: > So all I need do is test the first entry: > >local -a entries=("$1"/*) >[[ ${entries[0]} == $1/* ]] && return 0 > > --- the $1 doesn't need quotes in [[]] and '*' won't expand or > am missing something? Thanks for the tip Pierre, I often > don't see forests because

Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Linda Walsh
Chris Down wrote: Linda Walsh writes: So all I need do is test the first entry: local -a entries=("$1"/*) [[ ${entries[0]} == $1/* ]] && return 0 --- the $1 doesn't need quotes in [[]] and '*' won't expand or am missing something? Thanks for the tip Pierre, I often don't see forests b

Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Chris Down
Linda Walsh writes: > Pattern matching? Why doesn't '*' match anything then? I've no idea what you're doing, but: $ var='*bar*' $ [[ abarb = $var ]] $ echo $? 0 $ [[ aquxb = $var ]] $ echo $? 1 pgpUZ39g3TPmc.pgp Description: PGP signature

Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Pierre Gaston
On Sat, Apr 5, 2014 at 1:46 PM, Linda Walsh wrote: > > > Chris Down wrote: > >> Linda Walsh writes: >> >>> So all I need do is test the first entry: >>> >>>local -a entries=("$1"/*) >>>[[ ${entries[0]} == $1/* ]] && return 0 >>> >>> --- the $1 doesn't need quotes in [[]] and '*' won't exp

Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Linda Walsh
Pierre Gaston wrote: your test will also fail if there is one file named "*" it' better to just [[ -e ${entries[0]} ]] Sigh...so you are saying that: [[ ${entries[0]} == "$1/*" ]] && return 0 would fail if someone has a file named '*'. Hmmm...and whether the file exists or not, 'entri

UTF-8 printf string formating problem

2014-04-05 Thread Jan Novak
Hello, printf string format counts bytes instead of chars, which leads to broken output ... just try this: (/usr/bin/printf is broken too) $ echo $LANG us_US.UTF-8 $ printf "|%4s|\n" "aa" | aa| $ printf "|%4s|\n" "áá" (chars are a-acute) |áá| expected output: | áá| IMHO this is a big b

Re: UTF-8 printf string formating problem

2014-04-05 Thread Chris Down
Jan Novak writes: > printf string format counts bytes instead of chars, which leads to > broken output According to POSIX, printf's field width control is strictly in bytes, not characters.[0] > field width: > An optional string of decimal digits to specify a minimum field > width. For a

Re: UTF-8 printf string formating problem

2014-04-05 Thread Andreas Schwab
Jan Novak writes: > IMHO this is a big bug, because it breaks any non ASCII chars formating. It is consistent with printf(3). Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different.