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:
Shell-5.shell echo CommandEcho---display contentFormat: Echo [options] Text-N Do not wrap in the last line-E parsing escape character\a issued a warning sound\c Finally, no newline symbol is added.\f Line break\ r Enter1.-N do not wrap in the last
Shell echo CommandThe echo command of the Shell is similar to the echo command of PHP, and is used for the output of strings. Command format:StringYou can use echo to achieve more complex output format control.1. Display Normal string:" It is a test
Shell echo Command echo"It is a test"The double quotes here are completely omitted.3The . Display variable read command reads a line from the standard input and assigns the value of each field in the input row to the shell variable #!/bin/SH read
Transferred from: Feng yunzhi:Http://witmax.cn/shell-echo-spaces.html
When the echo variable is in shell, only one space is printed in the variable, as shown below:
1 Sh-3.2$ TMP="A B d"2 Sh-3.2$ Echo $ TMP3 A B d
The solution is to add double
Shell echo command and shellecho commandDisplay the variable read command to read a line from the standard input, and specify the value of each field in the input line to the shell variable
#! /Bin/shread name echo "$ name It is a test"The above
Shell echo CommandThe echo command of the Shell is similar to the echo command of PHP, and is used for the output of strings. Command format:echo stringYou can use echo to achieve more complex output format control.1. Display normal string:echo "It
Show VariablesThe read command reads a row from the standard input and assigns the value of each field in the input row to the shell variable#!/bin/shread name echo "$name It is a test"The above code is saved as test.sh,name to receive the standard
Echo is an internal command of the shell that prints the specified string on the screen. Command format:
Echo Arg
You can use echo to achieve more complex output format control.Show escape characters
echo "\"It is a test\ ""
Echo is an internal command of the shell that prints the specified string on the screen. Command format:Echo ArgYou can use echo to achieve more complex output format control.Show escape charactersecho "\" It is a test\ ""The result will be:"It is a
Usage: seq [options] ... TailOr: seq [options] ... First Count MantissaOr: seq [options] ... First number increment MantissaTwo ways to cycle from 1 to 100 (bash other shells have not tried)For x in ' seq 1 ';d o echo $x;d oneFor x in {1..100};d o
######### #20150419 ############################# #题目: Variable a= ' a/b/c ' how to intercept get c @@@@@@@@@@@@@@@@ From the operation and maintenance class 21 long wing finishing @@@@@@@@@@@@@@@@@@@[[email protected] shell]$ uname -r 2.6.32-504.
${#string}Returns the length of the $string
${string:position}In $string, start extracting substrings from the $position position
${string:position:length}In $string, the $length-length substring is extracted from the $position
20.16/20.17 functions in the shell• The function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly.Format: function F_name () {Command}The function has
Fundamentals of Shell ScriptingWriting specifications for 1.shell scripts2 variable and special variable application3 Local variables and global variables4 Test-judgment expressionIn some complex Linux maintenance efforts, a large number of
Functions in the shell1. First case:[[email protected] shell]# sh fun1.sh the first par is bthe second par is athe third par is 2the script name is fun1.shthe number of par is 5[[email protected] shell]# cat fun1.sh #!/bin/bashfunction inp(){
In the shell, the command execution succeeds with a return value of 0, and the unsuccessful return value is not 0Logic with:Shell 0 is true, not 0 is falseWhen the first condition is true, the second condition must be judged;When the first condition
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.