スクリプティング・自動化・コンテナ化
次のbashスクリプトを実行した場合、echoによって出力される数値はどれか。 x=4 y=2 echo $((x ** y + 10 / y))
- ✓21
- B18
- C24
- D16
解説
bashの算術展開では**はべき乗を表すためx**y=4**2=16、/は整数除算のため10/y=10/2=5となり、16+5=21が出力される。
根拠CompTIA Linux+ V8 シラバス Automation, Orchestration, and Scripting - Shell scripting: Write and troubleshoot variables, functions, and logic flows.