差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
linux:bash [2015/08/08 00:40] – ともやん | 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 されたスクリプトのディレクトリパスの取得 ===== | ===== source されたスクリプトのディレクトリパスの取得 ===== | ||
<code bash> | <code bash> | ||
script_dir=$(cd $(dirname ${BASH_SOURCE: | script_dir=$(cd $(dirname ${BASH_SOURCE: | ||
- | < | + | </code> |
- | source されていいない場合 | + | source されていない場合は以下でも取得できる |
<code bash> | <code bash> | ||
script_dir=$(cd $(dirname $0); pwd) | script_dir=$(cd $(dirname $0); pwd) | ||
行 22: | 行 31: | ||
alias mysql='/ | alias mysql='/ | ||
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 | ||
+ | |||
</ | </ | ||
行 35: | 行 62: | ||
===== 参考文献 ===== | ===== 参考文献 ===== | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
[[http:// | [[http:// | ||
+ | [[http:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ |