bug-bash
[Top][All Lists]
Advanced

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

Re: extension of file-test primitives?


From: L A Walsh
Subject: Re: extension of file-test primitives?
Date: Sun, 20 Aug 2017 14:20:38 -0700
User-agent: Thunderbird

PePa wrote:
In that case, would not [[ =fx $file ]] be more workable and in line with common GNU short commandline option practice??

Do you mean '-fx' ?  I assume you are meaning as an alternate?
It would be fine with me, even better on an aesthetic sense, however,
Bash already has multi-character ops starting with a dash.

While "-ge $file" could probably be parsed reliably apart from
"$file2 -ge $file", they look similar to a human and might create
more confusion than help.  (-ge $file == exists & groupid set), vs
testing contents of integer vars $file2 and $file for integer-var $file2
being greater-than-or-equal to integer-var $file.

Leveraging the curly brace format, implying [[ -{g,e} $file ]] would be
similar to the quoted example I mentioned.  I.e. -- it would be
a matter of applying brace expansion even though quotes didn't exist.

I.e. instead of:

eval 'test -'{g,e}' /bin/ls && :' && echo executable file

one could remove the eval, quotes and extra '&& :' at the end and
use:

 test -{g,e} /bin/ls && echo executable file

I _think_ people who are familiar w/brace expansion would
easily understand this new form and not confuse it with
existing features.

Does that make sense?
-l




reply via email to

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