Shell Basic Learning

Source: Internet
Author: User
Tags control characters echo command

From Shell13 asked

-E: Activate the conversion of the backslash control character (refer to the following table)

-e: Turn off anti-skew control character conversion (preset)

-N: Cancel line end of line symbol (with the \c character under the-e option)

To cancel a variable, you can use the unset command in bash to handle it:
Code: unset A
For EP:A=BCD

Echo $a

Unset $a

Variable set mode str not set STR has been set whether it is not an empty string
VAR=${STR=EXPR} str=expr Str invariant
var=expr var= $str

VAR=${STR:=EXPR} Whether or not Str has a definition, it will be redefined to assign a value

$# 是传给脚本的参数个数

$0是脚本本身的名字

$1 是传递给该shell脚本的第一个参数 $2 是传递给该shell脚本的第二个参数 [email protected] 是传给脚本的所有参数的列表 $* 是以一个单字符串显示所有向脚本传递的参数,与位置变量不同,参数可超过9 $$ 是脚本运行的当前进程ID号 $? 是显示最后命令的退出状态,0表示没有错误,其他表示有错误

In the last two echo commands, you will find that the argument part is displayed in your fluorescence screen, and the line break
There is no difference between the "-n" option.
Obviously, the second echo is canceled by the line break, and the next shell prompt is connected to the
The results of the same line ... ^_^
In fact, Echo, in addition to the-N options, has the following common choices:
7-E: Activate the inverse of the control character conversion (refer to the following table)-e: Close the inverse of the control character conversion (this is the case)-N: Cancel line end of the line symbol (with the-e option under the \c character consent)
The following table lists the anti-skew control characters supported by the echo command:

\a:alert/bell (from the system speaker)

\b:backspace, that is, to the left to remove keys

\c: Cancel line end of line break

\e:escape, jump Keys

\f:formfeed, page character

\n:newline, replacing line characters

\r:return, back to the car keys

\t:tab, table-hopping keys

\v:vertical TAB, Vertical table-hopping keys

\N:ASCII Eight Import code (16-bit X first)

\ \: The backslash itself (tabular information from O ' Reilly publishing house learning the Bash Shell, 2nd Ed.)



Shell Basic Learning

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.