Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Echo command difference between single quotation marks / double quotation marks / without quotation marks

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

No quotation marks: the string is output as is, and the variable will be replaced

Single quotation marks: the contents of the quotation marks will be displayed intact

Double quotes: the special symbols inside will be parsed and the variables will be replaced

Program:

#! / bin/bash

Echo "hello\ nworld" # "non-variable content, direct output

Echo-n "I LOVE YOU\ n ^ 3 ^" #-n means "" content is not escaped

Echo-e "YOU KNOW\ n I DO" #-e escapes "" content

Name= "1234" # defines a name string

Echo $name # output variable name content

Echo\ $name # directly output the content after "\"

Echo "$name" # "output variable name content

Output as is in echo'$name' #'

Run:

Hello\ nworld

I LOVE YOU\ n ^ 3 ^ You KNOW

I DO

1234

$name

1234

$name

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report