logo
  • 教程列表
  • SO官方文檔
  • 與 bash 的主要區別
    • 別名
    • 管道和子殼
    • 引用的差異
    • 萬用字元處理
  1. StackOverflow 文件
  2. zsh 教程
  3. 與 bash 的主要區別
  4. 引用的差異

引用的差異

Created: November-22, 2018

在 bash 中,你必須引用引數以保留空白:

# bash

function print_first_argument {
    echo "$1"
}

argument="has white space"
print_first_argument "$argument"

在 Zsh 中,由於評估順序不同,因此你不需要引號:

# zsh

function print_first_argument {
    echo $1
}

argument="has white space"
print_first_argument $argument
  • 萬用字元處理
  • 管道和子殼

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明