パラメータ展開
参考:
シェル芸人への道 Bash の変数展開と真摯に向き合う – Qiita
bash のパラメータのブレース展開での拡張子・ディレクトリ名・ファイル名の取得・拡張子の置換 | それマグで!
bash でパラメータ展開を用いて変数を利用する | 俺的備忘録 〜なんかいろいろ〜
Bash の変数パラメータ展開のまとめ | harry’s memorandum
Bash の変数パラメータ展開はやっぱし便利 | harry’s memorandum
How To Use Bash Parameter Substitution Like A Pro | nixCraft
Variables and Expansions | The Bash Guide
Bash variables and command substitution | Computational Methods in the Civic Sphere
An introduction to parameter expansion in Bash | Opensource.com
Parameter Substitution – Advanced Bash-Scripting Guide | The Linux Documentation Project
リファレンス
参考:
Parameter expansion | Bash Hackers Wiki
Shell Parameter Expansion | Bash Reference Manual (gnu.org)
代入
hoge=$fuga hoge=`echo "hello"` hoge=$( echo "hello" )
参考:
シェルスクリプト (sh / bash / zsh) で変数から変数へ代入する方法について – Qiita
文字列を置換する
${var/pattern/replace}
:最初にマッチした文字列を置換${var//pattern/replace}
:全ての文字列を置換
参考:
indirect variable expansion
$ fire="red!" $ color="fire" $ echo "${!color}" red!
参考:
Bash expand variable in a variable – Stack Overflow
How to use a variable as part of an array name – Unix & Linux Stack Exchange
How do I assign a variable in Bash whose name is expanded ($) from another variable? – Ask Ubuntu
JSON の構築
参考:
bash で JSON に変数を埋め込むための3つの方法 | DevelopersIO
Tips/まとめ
参考: