[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: /dev/fd/62: No such file or directory
From: |
Pierre Gaston |
Subject: |
Re: /dev/fd/62: No such file or directory |
Date: |
Wed, 2 Apr 2014 07:54:58 +0300 |
On Wed, Apr 2, 2014 at 6:04 AM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> 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.
>
>
> why not simply: entries=("$1"/*) ?
- Re: /dev/fd/62: No such file or directory, Linda Walsh, 2014/04/01
- Re: /dev/fd/62: No such file or directory,
Pierre Gaston <=
- Re: /dev/fd/62: No such file or directory, Greg Wooledge, 2014/04/02
- Re: /dev/fd/62: No such file or directory, Linda Walsh, 2014/04/05
- Re: /dev/fd/62: No such file or directory, Chris Down, 2014/04/05
- Re: /dev/fd/62: No such file or directory, Linda Walsh, 2014/04/05
- Re: /dev/fd/62: No such file or directory, Chris Down, 2014/04/05
- Re: /dev/fd/62: No such file or directory, Pierre Gaston, 2014/04/05
- Re: /dev/fd/62: No such file or directory, Linda Walsh, 2014/04/05