Re: [LTP] [PATCH v9 2/5] Add script to generate arch(s) dependant syscalls

Petr Vorel
2024-11-01T11:30:47Z

Hi Andrea,

...
> + for syscall in $(cat ${TEMP}/syscall-names.txt); do
> + printf "
> + #ifdef __NR_$syscall
> + printf(\"$syscall %%d"
> + # i know the following print is ugly, but dash and bash
> + # treat double quoted strings in a different way and we
> + # really need to inject '\n' character in the C code
> + # rather than carriage return
> + printf '\\n'
> + printf "\", __NR_$syscall);

How about using heredocs? IMHO more compatible way of echo/printf "" for new
lines:
cat << EOF
...
EOF

I should have noted that at previous version.
Hint: looking into tst_test.sh can sometimes help.

Also there is echo/printf '' variant:
cat << 'EOF'
EOF
https://unix.stackexchange.com/questions/462593/how-to-escape-a-character-in-a-heredoc-bash-script/462595#462595

There is also ~EOF - ignore leading whitespace, even for terminating EOF.

Kind regards,
Petr