git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] tests: add initial bash completion tests

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 7, 2012, 00:02 UTC
Message-ID
<CAMP44s2KjEYsHeufyon8aKj=tL+uuJiVBMnrzbYdePOJs1iZ-A@mail.gmail.com>
In-Reply-To
<7vbon4zb89.fsf@alter.siamese.dyndns.org>
On Sat, Apr 7, 2012 at 2:33 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>
>>> 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
>> ...
>> Other than that, it is very much simple and straight-forward.  I like it.
>
> It probably is even simpler to do it like this.
>
> if test -z "$BASH" && ! exec bash "$0" "$@"
That would exit immediately with an error:

t9902-completion.sh: 6: exec: bash: not found make: *** [t9902-completion.sh] Error 127

-- 
Felipe Contreras
Previous: Junio C HamanoNext: Jeff King
Message 17 of 18 in “tests: add initial bash completion tests”
  1. tests: add initial bash completion testsFelipe Contreras, Apr 6, 2012
  2. Jeff KingApr 6, 2012
  3. Junio C HamanoApr 6, 2012
  4. Felipe ContrerasApr 6, 2012
  5. Jeff KingApr 6, 2012
  6. Felipe ContrerasApr 6, 2012
  7. Junio C HamanoApr 6, 2012
  8. Felipe ContrerasApr 6, 2012
  9. Jeff KingApr 6, 2012
  10. Felipe ContrerasApr 6, 2012
  11. Junio C HamanoApr 6, 2012
  12. Felipe ContrerasApr 6, 2012
  13. Jeff KingApr 6, 2012
  14. Felipe ContrerasApr 6, 2012
  15. Junio C HamanoApr 6, 2012
  16. Junio C HamanoApr 6, 2012
  17. Felipe ContrerasApr 7, 2012
  18. Jeff KingApr 6, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.