This article is part of the Linux Shell Series Tutorial (eight), more shell tutorials: Linux Shell Tutorials
In previous: Linux Shell series Tutorial (vii) Shell output This article has a brief introduction to the Shell printf command, which
The printf command is used to format the output and is an enhanced version of the echo command. It is a finite variant of the C-language printf () library function, and is somewhat different in syntax.Note: printf is defined by the POSIX standard,
The printf command mimics the printf () program in the C library.Standard, so scripting with printf is better than using echo portability.printf uses reference text or space-delimited parameters, which can be used outside of the format string in
Shell learning: Shell echo, printf, test command, echotestShell learning: Shell echo, printf, test command Shell echo command
Show normal strings
echo "hello"
Output: hello
Double quotation marks can be omitted as follows:
echo hello
Output:
The printf command is used to format the output and is an enhanced version of the echo command. It is a finite variant of the C-language printf () library function, and is somewhat different in syntax.Note: printf is defined by the POSIX standard,
The printf command is used to format the output and is an enhanced version of the echo command. It is a finite variant of the C-language printf () library function, and is somewhat different in syntax.Note: printf is defined by the POSIX standard,
The printf command is used to format the output and is an enhanced version of the echo command. It is a finite variant of the C-language printf () library function, and is somewhat different in syntax.Note: printf is defined by the POSIX standard,
in the previous section we learned about the Shell's echo command, which we'll learn from the Shell's other output command printf.
The printf command mimics the printf () program in the C library.
Standard, so scripting with printf is better than
Summarize:(1) printf uses reference text or space-delimited parameters, which can be used to format strings in printf, as well as the width of strings, left and right alignment, and so on. Default printf does not automatically add line breaks like
In the previous section we learned about the Shell's echo command, which we'll learn from the Shell's other output command printf.The printf command mimics the printf () program in the C library.printf is defined by the POSIX standard, so scripting
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.