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:
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
1) Unix command:
Although any Unix command can be used in shell scripts, some more common commands are used. These commands are usually used for file and text operations.
Common command syntax and functions:
Echo"Some text": print the text on
To become a flexible tool, a qualified script must provide additional information to describe the role of the script, how it is executed, and where it is executed. Like the command, the script also uses parameters. Switches and parameters increase
Ehco and returnreturn Returned is the status code, function end Return does not return function return value You can return the function return value with echo in front, return the specified function exit status code Echo returns the
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 more by the POSIX standard, so a
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.