Process substitution is not specified by POSIX, so not all POSIX shell support it, only some shells like bash
, zsh
, ksh88
, ksh93
support.
In Centos
system, /bin/sh
is symlink to /bin/bash
. When bash
is invoked with name sh
, bash
enters posix mode (Bash Startup Files - Invoked with name sh). In posix mode, process substitution
is not supported, cause syntax error.
Script should work, if you call bash
directly bash test.sh
. If not, maybe bash
has entered posix mode. This can be occur if you start bash
with --posix
argument or variable POSIXLY_CORRECT
is set when bash
start:
$ bash --posix test.sh
test.sh: line 54: syntax error near unexpected token `('
test.sh: line 54: `paste <(printf "%s\n" "TOP")'
$ POSIXLY_CORRECT=1 bash test.sh
test.sh: line 54: syntax error near unexpected token `('
test.sh: line 54: `paste <(printf "%s\n" "TOP")
Or bash
is built with --enable-strict-posix-default
option.
dash
instead ofbash
). – steeldriver yesterday#!/bin/sh
at the top. I executed asbash test.sh
but it did not work either. – NecNecco yesterdaybash
in POSIX mode doesn't support that syntax either (when called with--posix
or as/bin/sh
). Use#!/bin/bash
. – jordanm yesterdayPOSIXLY_CORRECT
variable set when you startbash
? – Gnouc yesterday#!/bin/bash
at the top fixed the problem. – NecNecco yesterday