다음을 추가하여 ~ / .profile 파일을 변경했습니다.
PATH="/user/share/android-sdk-linux/tools:$PATH"
그런 다음 로그 오프했다가 다시 로그인하지만 경로는 $ PATH 환경 변수에 추가되지 않습니다. 터미널을 확인 중입니다.
echo $PATH
/usr/share/android-sdk-linux/tools:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.7.0_17/bin
조언 해주세요
편집하다
나는 심지어 시도했다 :
PATH=$PATH:/usr/share/android-sdk-linux/tools
EXPORT PATH
여기서도 운이 없다.
편집 2
~ /. 프로필 :
# ~/.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
# set path to android
# PATH = $PATH:/usr/share/android-sdk-linux/tools
# EXPORT PATH
PATH="/usr/share/android-sdk-linux/tools:$PATH"
~ / .bachrc 또는 / etc / environment에 추가 :
PATH="/usr/share/android-sdk-linux/tools:$PATH"
작동하지만 ~ / .profile이 아닌 이유는 무엇입니까?
답변
올바르게 이해했다면 PATH envar의 값을 영구적으로 변경하고 싶습니다.
우분투에서 PATH envar는 /etc/environment
파일 내부에 정의되어 있습니다. 따라서 .profile이 아닌 해당 파일 내에서 PATH envar 선언을 수정해야합니다!
모든 사용자의 PATH 값을 변경하려는 경우에만 사용하십시오!
답변
=
bash에서 변수에 값을 지정할 때 전후에 공백을 사용하지 마십시오 . 올바른 방법은 다음과 같습니다.
PATH="/user/share/android-sdk-linux/tools:$PATH"
변경 사항을 적용 .profile
하려면 다음 명령을 사용하여 컴퓨터를 다시 시작하거나 파일을 소싱하십시오 .
source ~/.profile
모든 사용자의 경로를 변경하려면 /etc/profile
파일 에 해당 행을 추가 하십시오. 다시 시작해야합니다.