首页 > 系统服务 > 详细

shell 字符串拼接

时间:2019-08-23 23:41:38      阅读:274      评论:0      收藏:0      [点我收藏+]

 

test.sh

#!/bin/bash
your_name="runoob"
# 使用双引号拼接
greeting="hello, "$your_name" !"
greeting_1="hello, ${your_name} !"
echo $greeting  $greeting_1
# 使用单引号拼接
greeting_2=hello, $your_name !
greeting_3=hello, ${your_name} !
echo $greeting_2  $greeting_3

输出

bogon:Desktop macname$ ./test.sh 
hello, runoob ! hello, runoob !
hello, runoob ! hello, ${your_name} !

 

shell 字符串拼接

原文:https://www.cnblogs.com/sea-stream/p/11403094.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!