Shell 脚本字符串拼接

直接看代码

[hui@hadoop101 ~]$ cat str.sh 
#!/bin/ssh

name="hello "
age="world"

info="$name $age"
info1=$name$age
info2=$name": "$age
info3="$name: $age"



echo $info
echo $info1
echo $info2
echo $info3
[hui@hadoop101 ~]$ sh str.sh 
hello world
hello world
hello : world
hello : world

 

posted @ 2024-03-24 15:43  晓枫的春天  阅读(22)  评论(0编辑  收藏  举报