お知らせ

  • 利用規約を守って投稿してください。また、よくある質問および投稿の手引きも参照してください。
  • メッセージの投稿にはアカウントが必要です。未登録の方は、ユーザ登録ページからアカウントを作成することができます。

#1 2015-10-29 13:17:59

koyayashi
新しいメンバ
登録日: 2015-10-29

~/.profileについて

14.04LTSを使用しています。
PATHを通そうと思って’~/.profile’を変更していたのですがうまく行かず、もとに戻そうと思ったのですがデフォルトの状態や文法がわからず、困っています。
現在PCの動作に支障はないのですが起動するたびに「>予期しないトークン `if' 周辺に構文 エラーがあります -」と表示が出ます。
どこを直せばいいか教えていただきたいです。
↓~/.profileの現在の内容↓

    "$HOME/.bashrc"
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    PATH="$HOME/bin:$PATH"
    fi
# exists.
# for ssh logins, install and configure the libpam-umask package.
# if running bash
# see /usr/share/doc/bash/examples/startup-files for examples.
# set PATH so it includes user's private bin if it exists
# the default umask is set in /etc/profile; for setting the umask
# the files are located in the bash-doc package.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# ~/.profile: executed by the command interpreter for login shells.
#umask 022
fi
fi
if [ -d "$HOME/bin" ] ; then
if [ -n "$BASH_VERSION" ]; then

オフライン

 

#2 2015-10-29 14:47:35

nobuta
新しいメンバ
登録日: 2009-07-17

Re: ~/.profileについて

中身がめちゃめちゃになっていますね。もとはこれだと思います。

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

PATH に値を追加するには

PATH="/xxx/yyy:$PATH"

を最後に追加するだけです。

オフライン

 

#3 2015-10-29 14:50:17

nussba_tm
メンバ
登録日: 2014-12-18

Re: ~/.profileについて

/etc/skel/.profile
に初期ファイルがあります。

オフライン

 

#4 2015-10-30 03:27:42

koyayashi
新しいメンバ
登録日: 2015-10-29

Re: ~/.profileについて

お二方ありがとうございます。無事に解決しました。

オフライン

 

Board footer

Powered by FluxBB