Skip to content

Instantly share code, notes, and snippets.

@s-age
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-age/9871497 to your computer and use it in GitHub Desktop.
Save s-age/9871497 to your computer and use it in GitHub Desktop.
zsh でシェルスクリプトを書くいくつかの理由

zsh でシェルスクリプトを書くいくつかの理由

  • 標準で入っていることが多い
  • 連想配列が大体の環境で使える
  • bash だと4.0以上が必要になって、大体の環境で使えない
  • 正規表現の後方参照が短く書ける
  • bash: ${BASH_REMATCH[n]}
  • zsh: ${match[n]}
  • 無名関数が使える
  • これも bash だと4.0以上が必要になって、大体の環境で使えない
  • 数値型がある(integer)
  • 小数も扱える
  • 範囲演算子使える
for i in {0..100}
do
    :
done
  • main とか書かなくても、JavaScript の ( function () {} ) () 的なこと出来る
() {
    :
}

あとがき

  • コンソールは bash だけどね♪
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment