Bash 4: unexpected EOF while looking for matching `)'
11
votes
1
answer
1313
views
This very simplified version of my script
#!/usr/bin/env bash
example="$(bash -rs <<'BASH' -- 'This has been executed in restricted shell'
echo "$1"
BASH
)"
echo "$example"
is executed without problems on a system with bash version 5.1.4. However, on another system with bash version 4.0.44, I get the error
line 2: unexpected EOF while looking for matching `)'
If I change the script to
#!/usr/bin/env bash
example="$(bash -rs <<'BASH'
echo 'This has been executed in restricted shell'
BASH
)"
echo "$example"
or
#!/usr/bin/env bash
bash -rs <<'BASH' -- 'This has been executed in restricted shell'
echo "$1"
BASH
it also works on the system with bash version 4.
Does anyone have an idea what could be the reason?
Asked by pedral
(121 rep)
Apr 10, 2024, 09:00 AM
Last activity: Apr 10, 2024, 09:54 AM
Last activity: Apr 10, 2024, 09:54 AM