Bash shell中的双引号与单引号用法示例

 

#!/bin/bash

 

fruit=apricot

area=beijing

 

#输出为apriot\nbeijing

echo "$fruit\n$area"

 

#输出为apriot\beijing

echo "$fruit\\$area"

 

#输出为aprioteijing

echo -e "$fruit\\$area"

 

#输出为apriot

#         beijing

echo -e "$fruit\n$area"

 

#输出为$fruit\n$area

echo '$fruit\n$area'

 

#输出为$fruit\\$area

echo '$fruit\\$area'

 

#输出为$fruit\$area

echo $'$fruit\\$area'

 

#输出为$fruit

#         $area

echo $'$fruit\n$area'

posted on 2017-08-22 06:15  佛哥  阅读(474)  评论(0编辑  收藏  举报

导航