Skip to content

Instantly share code, notes, and snippets.

@disktnk
Created November 18, 2012 08:44

Revisions

  1. disktnk revised this gist Nov 18, 2012. No changes.
  2. disktnk renamed this gist Nov 18, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. disktnk created this gist Nov 18, 2012.
    25 changes: 25 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    Application > Terminalを起動したとき,環境変数の追加その他もろもろを自動でやってほしいとき,.bashrcを編集すればよい.

    初期状態では,ホームディレクトリに.bashrcファイルはないので,自分で作成する.

    ```shell
    cd ~
    vi .bashrc
    ```

    例えば`PATH`に何かを追加したいときは,以下を足して保存.

    ```shell
    export PATH=$PATH:/usr/sample/something1
    export PATH=$PATH:/usr/sample/something2
    ```

    でもこれだけだとだめで,.bash_profileファイルに以下のコードも必要.この.bash_profileファイルも初期状態ではホームディレクトリには無いので,新規作成.

    ```shell
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi
    ```

    これで,次にTerminalを起動したときは,.bashrcの内容が実行される.