1

In a fresh, clean bash instance I get as expected the following:

$ printf "a\td\n" | cat -vE
a   d$
$
$ file <(printf "a\td\n" | cat -vE)
/dev/fd/63: symbolic link to pipe:[6664004]

However I currently have a bash instance that returns:

$ printf "a\td\n" | cat -vE
a   d$
$
$ file <(printf "a\td\n" | cat -vE)
bash: syntax error near unexpected token `('
$
$ type -a printf
printf is a shell builtin
printf is /usr/bin/printf
printf is /bin/printf
$
$ type -a file
file is /usr/bin/file
file is /bin/file

What could be causing this error?

If I compare the environment variables, there is no significant difference with a fresh bash instance. Similarly, I see nothing special in the variables that currently exist in the session. Any clue?...

1 Answer 1

1

I happened to have the variable POSIXLY_CORRECT set as I had earlier run set -o posix.

It was in my list of variables as POSIXLY_CORRECT=y but it did not occur to me at first sight that this could be the cause. (I was rather searching for any interference with the names of the commands.)

Resetting using set +o posix solved the problem.

3
  • another answer mentioned a while back that Bash 5.1 allows process substitutions even in POSIX mode.
    – ilkkachu
    Sep 19, 2021 at 7:15
  • Note that running sh -a on systems where sh is bash is enough to set that POSIXLY_CORRECT environment variable (and all commands run within that sh session will be in POSIX mode). Sep 19, 2021 at 7:15
  • On my system (Linux Mint 20.2): bash --version > GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
    – The Quark
    Sep 19, 2021 at 7:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .