Re: [RFC/PATCH] tests: add initial bash completion tests
- From
Jeff King <peff@peff.net>
- Date
- Apr 6, 2012, 23:52 UTC
- Message-ID
- <20120406235209.GB31750@sigill.intra.peff.net>
- In-Reply-To
- <CAMP44s3-Ji33oG=Os_O9KpxawWzZzmiZ04QMTokQ+K6_x-31MA@mail.gmail.com>
On Sat, Apr 07, 2012 at 02:12:22AM +0300, Felipe Contreras wrote:
Show 25 quoted lines
> On Fri, Apr 6, 2012 at 11:19 PM, Jeff King <peff@peff.net> wrote: > > > I think you need to start with something like: > > > > #!/bin/sh > > > > if ! type bash; then > > echo '1..0 # SKIP skipping bash tests, bash not available' > > exit 0 > > fi > > What about this instead? > > --- > #!/bin/sh > > if type bash >/dev/null 2>&1 > then > # execute inside bash > [ -z "$BASH" ] && exec bash $0 > else > echo '1..0 #SKIP skipping bash completion tests; bash not available' > exit 0 > fi > ---
Yes, that's fine. It should be functionally equivalent to what I posted, but without having to invoke an extra bash when we are already running it (and avoiding the giant here-doc, though that is simply ugly and not a functional problem).
One minor fix. I think it should be:
exec bash $0 "$@"
to pass arguments (e.g., "-v -i") to the bash sub-process.
-Peff