Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
qingfeng
V2EX  ›  Linux

shell脚本中`反引号是做什么用的?

  •  
  •   qingfeng · Oct 12, 2013 · 5912 views
    This topic created in 4603 days ago, the information mentioned may be changed or developed.
    shell脚本中`符号是做什么用的,就是键盘上Tab键上面一个键?是不是执行一个命令组合的时候前后都得必须加这个符号,比如:
    cmd=`echo -n "$1" | wc -c | sed 's/ //g'`
    retval=`cut -b $cmd`
    3 replies    1970-01-01 08:00:00 +08:00
    L0rAx
        1
    L0rAx  
       Oct 12, 2013
    第一句解释为:将echo -n "$1" | wc -c | sed 's/ //g'得到的结果赋值给cmd
    bluntblade
        2
    bluntblade  
       Oct 12, 2013
    命令替换,将``中的命令的输出结果原地替换。
    yesono
        3
    yesono  
       Oct 13, 2013
    和 $(...) 一样
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1452 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 17:02 · PVG 01:02 · LAX 10:02 · JFK 13:02
    ♥ Do have faith in what you're doing.