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 --
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
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
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
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
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
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
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
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.