[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: failglob handling
From: |
Greg Wooledge |
Subject: |
Re: failglob handling |
Date: |
Fri, 3 Aug 2018 10:59:37 -0400 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Fri, Aug 03, 2018 at 03:29:33PM +0200, Thomas Deutschmann wrote:
> However, see the following interesting difference between semicolons and
> newlines:
>
> > $ echo "shopt -s failglob; echo /foo/bar/*; echo alive; " | bash
> > bash: line 1: no match: /foo/bar/*
Yeah, my own testing confirms that basically, if failglob triggers,
it takes out the entire LINE of commands, not just the one command
that triggered it.
wooledg:~$ shopt -s failglob
wooledg:~$ : /none/*
bash: no match: /none/*
wooledg:~$ : /none/* ; echo hi
bash: no match: /none/*
wooledg:~$ : /none/* || echo hi
bash: no match: /none/*
wooledg:~$ if : /none/* ; then echo yes; else echo no; fi
bash: no match: /none/*
Or, the entire compound command, even if it's across multiple lines:
wooledg:~$ if : /none/* ; then
> echo yes; else echo no; fi
bash: no match: /none/*
That's as far as I cared to test it. Just another thing to toss on the
heap of not-so-useful shell toys, like set -u. Not suitable for real
work.