zoukankan      html  css  js  c++  java
  • shell 字符串拼接

    #!/bin/bash
    
    name="Shell"
    url="http://c.biancheng.net/shell/"
    
    str1=$name$url  #中间不能有空格
    str2="$name $url"  #如果被双引号包围,那么中间可以有空格
    str3=$name": "$url  #中间可以出现别的字符串
    str4="$name: $url"  #这样写也可以
    str5="${name}Script: ${url}index.html"  #这个时候需要给变量名加上大括号
    
    echo $str1
    echo $str2
    echo $str3
    echo $str4
    echo $str5

    输出

    Shellhttp://c.biancheng.net/shell/
    Shell http://c.biancheng.net/shell/
    Shell: http://c.biancheng.net/shell/
    Shell: http://c.biancheng.net/shell/
    ShellScript: http://c.biancheng.net/shell/index.html

     参考:

    http://c.biancheng.net/view/1114.html

  • 相关阅读:
    CF1132G
    CF1129B
    CF1131G
    CF1109D
    CF1110H
    CF1106F
    my.cnf 配置
    mysql 导入导出
    mysql 批量删除表数据
    国内开源镜像站
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11977266.html
Copyright © 2011-2022 走看看