bug-bash
[Top][All Lists]
Advanced

[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: Tue, 01 Apr 2014 20:04:17 -0700
User-agent: Thunderbird



Greg Wooledge wrote:
On Fri, Mar 28, 2014 at 06:14:27PM -0700, Linda Walsh wrote:
Does read varname <<<$(...) use process substitution?

I wouldn't dare write it like that, because who knows how the parser
will treat it.  I'd write it this way:

read varname <<< "$(...)"

This is a command substitution and a here-string.  Here-strings are
implemented with a temporary file, I believe.
----
Well don't know if it circumvents the /fd/62 prob
yet (got a few places more to check & convert),
but this seems to work for checking if a file
or dir is empty:

function empty {
  [[ $# -lt 1 ]] && return -1
  [[ -f $1 && ! -s $1 ]] && return 0
  [[ -d $1 ]] && {
    readarray entries<<<"$(cd "$1" && printf "%s\n" * 2>/dev/null)"
    ((${#entries[@]} < 3)) && return 0
  }
  return 1
}

Had one with find+wc, but this one doesn't rely on any
sub-utils.




reply via email to

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