In this article, we will see how to use printf like echo with advanced usage.
Printf is similar to echo in bash shell but brings extra functionality. "%s" can get argument as insert into what printf is outputing to screen.
Lets look to its syntax.
printf "\napache test output %s" log.txt log1.txt log2.txt
Lets see it in bash shell scripting example.
As above output indicates, w printf to output to shell with using "%s". We added 3 file name after printf echo string , and as output indicates, printf took that 3 different file as insert into its echo string .