[Top][All Lists]

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

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

From: Linda Walsh
Subject: Re: /dev/fd/62: No such file or directory
Date: Sat, 05 Apr 2014 03:33:14 -0700
User-agent: Thunderbird

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)"
    ((address@hidden < 3)) && return 0

That's unnecessarily complex.

why not simply: entries=("$1"/*) ?
Indeed -- I just got around to changing this (been an odd week)...
combining it with a hint from greg:

You need to activate nullglob and dotglob first, but yes, that would be
the way I'd recommend.
dotglob is already activated, nullglob is not.  I thought about it
if nullblob is unset, then I'll always have 1 element in the array --
so I don't have to worry about coding for an 'unset' value.

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 of all the trees...

reply via email to

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