why sudo -s ‘printf "xx"’ cannot handle newline?

When calling the following command directly, the newline can be printed correctly.

printf "abc
def"

But when calling it with sudo -s, the newline is ignored.

sudo -s "printf 'abc
def'"

The $SHELL is using bash.


Source: shell

Leave a Reply