4
shopt -s failglob;
ls -l /non-existent/*; echo A;
echo B

only prints "B" (and the "no-match" error).

http://www.gnu.org/software/bash/manual/bashref.html#Filename-Expansion

says that the command that caused the expansion failure does not get executed; but not that the rest of the line is ignored. How to limit the effect of the expansion failure to the actual command only?
This is under GNU bash, version 4.2.45(1)-release (i586-pc-linux-gnu) on Gentoo-Linux.

codeforester
  • 39,467
  • 16
  • 112
  • 140
Nico Rittner
  • 189
  • 5
  • the expansion failure seem to be more an exception than a normal error; eval could handle it but maybe there is a more elegant solution for it – Nico Rittner May 29 '13 at 07:37
  • 2
    While the man page says the "command" is not executed, the implementation actually seems to prevent the entire "list" (i.e., a series of pipelines joined by `&`, `&&`, `||`, or `;`) from running. – chepner May 29 '13 at 13:14

1 Answers1

2

Since the failglob implementation seems faulty, your only option other than correcting bash could be to avoid putting further commands on the same input line.

Armali
  • 18,255
  • 14
  • 57
  • 171