KHO THƯ VIỆN 🔎

The linux command line, 2nd edition

➤  Gửi thông báo lỗi    ⚠️ Báo cáo tài liệu vi phạm

Loại tài liệu:     PDF
Số trang:         506 Trang
Tài liệu:           ✅  ĐÃ ĐƯỢC PHÊ DUYỆT
 











Nội dung chi tiết: The linux command line, 2nd edition

The linux command line, 2nd edition

khothu .comTHE LINUX COMMAND LINEA COMPLETE INTRODUCTIONor (hi' one:(■eflinuxbox ~)$ echo The total is $100.00The total is 00.00In (he first example,

The linux command line, 2nd edition word splitting by the shell removed extra whitespace from the echo command’s list of arguments. In the second example, parameter expansion substitute

d an empty string for tile value of $1 because it was an undefined variable. The shell provides a mechanism called quoting to selectively suppress unw The linux command line, 2nd edition

anted expansions.Double QuotesThe first type of quoting we will look at is double quotes. If we place text inside double quotes, all the special chara

The linux command line, 2nd edition

cters used bv the shell lose their special meaning and are treated as ordinary characters. The exceptions are $ (dollar sign), \ (backslash), and ' (b

khothu .comTHE LINUX COMMAND LINEA COMPLETE INTRODUCTIONor (hi' one:(■eflinuxbox ~)$ echo The total is $100.00The total is 00.00In (he first example,

The linux command line, 2nd edition metic expansion, and command substitution are still carried out. Using double quotes, we can cope with filenames containing embedded spaces. Sav we we

re the unfortunate victim of a file called two words.txt. If we tried to use this on the command line, word splitting would cause this to be treated a The linux command line, 2nd edition

s two separate arguments rather than the desired single argument.(■eậlinuxbox ~]s Is -1 two words.txtIs: cannot access two: No such file or directoryI

The linux command line, 2nd edition

s: cannot access words.txt: No such file or directoryBy using double quotes, we slop the word splitting and gel the desired result; further, we can ev

khothu .comTHE LINUX COMMAND LINEA COMPLETE INTRODUCTIONor (hi' one:(■eflinuxbox ~)$ echo The total is $100.00The total is 00.00In (he first example,

The linux command line, 2nd edition _words.txtThere! Now we don’t have to keep typing those pesky double quotes.Remember, parameter expansion, arithmetic expansion, and command substitut

ion still take place within double quotes.(■eflinuxbox ~]$ echo "SUSER $((2*2)) $(cal)“me 4 February 2020Su Mo Tu We Th Fr Sa12 3 4 5 6 7 89 10 11 12 The linux command line, 2nd edition

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29M chopwi 7We should take .1 moment to look at the effect of double quotes OU coin* maud substitution

The linux command line, 2nd edition

. First let's look a little deeper at how word splitting works. In our earlier example, we saw how word splitting appears to remove extra spaces in ou

khothu .comTHE LINUX COMMAND LINEA COMPLETE INTRODUCTIONor (hi' one:(■eflinuxbox ~)$ echo The total is $100.00The total is 00.00In (he first example,

The linux command line, 2nd edition haracters) and treats them as delimiters between words. This means unquoted spaces, tabs, and newlines are not considered to lx* part of the text. The

y serve only as separators. Because they separate the words into different arguments, our example command line contains a command followed by four dis The linux command line, 2nd edition

tinct arguments. If we add double quotes:[•eglinuxbox ~]$ echo "this is a test" this is a testthen word splitting is suppressed and the embedded space

The linux command line, 2nd edition

s are not treated as delimiters; rather, they' become part of the argument. Once the double quotes are added, our command line contains a command foll

khothu .comTHE LINUX COMMAND LINEA COMPLETE INTRODUCTIONor (hi' one:(■eflinuxbox ~)$ echo The total is $100.00The total is 00.00In (he first example,

The linux command line, 2nd edition t on command substitution. Consider (he following:[ae^linuxbox ~]$ echo $(cal)February 2020 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 IS 1

6 1718 19 20 21 22 23 24 25 26 27 28 29[ae^linuxbox echo "$(cal)“43862SuMo Tu We Th Fr Sa 1 The linux command line, 2nd edition

khothu .comTHE LINUX COMMAND LINEA COMPLETE INTRODUCTIONor (hi' one:(■eflinuxbox ~)$ echo The total is $100.00The total is 00.00In (he first example,

Gọi ngay
Chat zalo
Facebook