Re: Do test-path_is_{file,dir,exists} make sense anymore with -x?
- From
Jeff King <peff@peff.net>
- Date
- Feb 26, 2019, 21:02 UTC
- Message-ID
- <20190226210229.GB27914@sigill.intra.peff.net>
- In-Reply-To
- <nycvar.QRO.7.76.6.1902262055260.41@tvgsbejvaqbjf.bet>
On Tue, Feb 26, 2019 at 08:58:43PM +0100, Johannes Schindelin wrote:
Show 16 quoted lines
> On Tue, 26 Feb 2019, Jeff King wrote: > > > I had a vague notion that there was some reason (portability?) that we > > preferred to have the wrappers. But as your patch shows, they really are > > just calling "test" and nothing else. > > Let's also not forget about the fact that `test -f` is actually not all > that intuitive an interface. Whereas even somebody without training in > software development (let alone Unix shell scripting) understands the > meaning of > > test_path_is_file this-file.txt > > And even for a trained eye, the trace of `test -f` is sometimes hard to > read, as you do *not* see the exit code in the trace, so you have to guess > from circumstantial evidence whether it failed or succeeded.
True. For old-timers, I think "test -f" is idiomatic, but that is not true for everyone. Sometimes wrappers can cut both ways, making things harder for people who are used to the idioms. But "test_path_is_file" should be pretty readable for everyone, old and new alike, I would think.
-Peff