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

Petr Vorel pvorel@suse.cz
Fri Nov 1 12:30:19 CET 2024


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


More information about the ltp mailing list