FlashKeepers

Linux · CompTIA Linux+

Linuxシェルスクリプトの基礎

変数、ループ、条件分岐など、bashシェルスクリプトの基本概念。

40 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone
bashで変数を宣言して値を代入するにはどうしますか?
VARIABLE_NAME=value(イコール記号の前後にスペースを入れない)
bashで変数の値を参照する構文は何ですか?
$VARIABLE_NAME または ${VARIABLE_NAME}
変数を子プロセスで使えるようにエクスポートするコマンドは何ですか?
export VARIABLE_NAME
コマンドの結果を変数に代入するにはどうしますか?
VARIABLE=$(command) または VARIABLE=`command`
bashにおけるシングルクォートとダブルクォートの違いは何ですか?
ダブルクォートは変数展開とコマンド置換を許可し、シングルクォートはすべてをそのまま文字通りに扱います
bashスクリプトにおけるreadコマンドは何をしますか?
ユーザーからの入力を読み取り、変数に格納する
bashにおけるif文の基本構造は何ですか?
if [ condition ]; then commands; fi
if文でファイルが存在するかどうかを調べるにはどうしますか?
if [ -f /path/to/file ]; then
if文でディレクトリが存在するかどうかを調べるにはどうしますか?
if [ -d /path/to/directory ]; then
条件式で-zフラグは何を調べますか?
文字列が空(長さゼロ)かどうかを調べる
条件式で-nフラグは何を調べますか?
文字列が空でない(長さがある)かどうかを調べる
if文で2つの数値を比較するにはどうしますか?
角括弧の中で -eq、-ne、-lt、-le、-gt、-ge のいずれかを使う
bashにおけるif-else文の構文は何ですか?
if [ condition ]; then commands; else commands; fi
bashにおけるif-elif-else文の構文は何ですか?
if [ condition1 ]; then commands; elif [ condition2 ]; then commands; else commands; fi
bashにおけるforループの基本構造は何ですか?
for variable in list; do commands; done

25 more cards in the app