[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Weird set -u error



$ cat Makefile.test
SHELL := /bin/bash -u
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:

all:
        echo done
$ make -f Makefile.test
echo done
done
$ make -f Makefile.test | cat
echo done
/etc/bash.bashrc: line 7: PS1: unbound variable
done
$ cat <(make -f Makefile.test)
echo done
done
$


Why do I get that unbound variable error? (I know how to fix it, I just
don't understand why it only happens when I pipe the output)

And is this a bug? In make?

The only way I've managed to reproduce this other than as above is by
explictly sourcing /etc/bash.bashrc where there are a few places where
set -u can report unbound variables.

Tim


Reply to: