差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
linux:bash [2012/02/20 23:26] – [Bash(Bourne-Again Shell)] ともやん | linux:bash [2023/03/12 14:52] (現在) – [参考文献] ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
====== Bash(Bourne-Again Shell) ====== | ====== Bash(Bourne-Again Shell) ====== | ||
+ | |||
+ | ===== シェバン(shebang) ===== | ||
+ | bash を絶対パスを指定 | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | </ | ||
+ | env を使ってを指定 | ||
+ | <code bash> | ||
+ | # | ||
+ | </ | ||
+ | ===== source されたスクリプトのディレクトリパスの取得 ===== | ||
+ | <code bash> | ||
+ | script_dir=$(cd $(dirname ${BASH_SOURCE: | ||
+ | </ | ||
+ | |||
+ | source されていない場合は以下でも取得できる | ||
+ | <code bash> | ||
+ | script_dir=$(cd $(dirname $0); pwd) | ||
+ | </ | ||
===== alias の設定方法 ===== | ===== alias の設定方法 ===== | ||
行 13: | 行 32: | ||
alias mysqladmin='/ | alias mysqladmin='/ | ||
</ | </ | ||
+ | |||
+ | ===== 端末起動時のプロンプト表示が遅い ===== | ||
+ | pk-command-not-found で時間がかかって bash の起動に時間がかかる。\\ | ||
+ | .bashrc に unset command_not_found_handle を追記する。 | ||
+ | < | ||
+ | $ vi ~/.bashrc | ||
+ | </ | ||
+ | <code bash> | ||
+ | # .bashrc | ||
+ | |||
+ | # Source global definitions | ||
+ | if [ -f /etc/bashrc ]; then | ||
+ | . /etc/bashrc | ||
+ | fi | ||
+ | |||
+ | unset command_not_found_handle | ||
+ | |||
+ | </ | ||
+ | |||
===== .bashrc をログイン時に自動で読み込ませる ===== | ===== .bashrc をログイン時に自動で読み込ませる ===== | ||
.bash_profile に以下の記述を追加する。< | .bash_profile に以下の記述を追加する。< | ||
行 22: | 行 60: | ||
$ source .bash_profile | $ source .bash_profile | ||
</ | </ | ||
+ | |||
+ | ===== 参考文献 ===== | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[http:// | ||
+ | [[http:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ |