Sample Header Ad - 728x90

dash: why am I getting the error "Syntax error: EOF in backquote substitution" when my script doesn't even contain a backquote?

1 vote
1 answer
9761 views
#!/bin/sh -- for set_trap_sig in HUP INT QUIT ALRM TERM; do trap -- ' trap -- - '"${set_trap_sig:?}"' EXIT || exit "$?" kill -s '"${set_trap_sig:?}"' -- "$$" || exit "$?"' "$set_trap_sig" done sleep 15 || exit "$?" Here's what happens when I send SIGINT to the script user@hostname:/tmp$ ./script.sh ^C./script.sh: 3: ./script.sh: Syntax error: EOF in backquote substitution This issue seems specific to dash. On ash, bash and ksh93 I do not get this error. This is particularly weird because my script does not even contain the backquote character. If I remove the double quotes on the trailing $? on line 5 the error goes away. Am I doing something stupid or is dash misbehaving? Please, no comments about the level of error-checking in my scripts. We have now established that this a very serious bug that affects even modern versions of Ubuntu and Debian. Does anyone know of a workaround?
Asked by Harold Fischer (1974 rep)
Apr 20, 2019, 06:17 AM
Last activity: Dec 7, 2022, 08:26 PM