FlashKeepers

Linux · CompTIA Linux+ · Professional Certifications

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

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

About this set

40 basic cards for CompTIA Linux+ Linux. It opens with "bashで変数を宣言して値を代入するにはどうしますか?" and "bashで変数の値を参照する構文は何ですか?".

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

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

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

25 more cards in the app

Study this set free