2012. 12. 23. 18:54

bashrc 파일 설정(펌) / Fedora


o bashrc에서 prompt 설정하기 - 솔라리스

o bashrc파일 예제
: 아래 4개 파일이 각각 디렉토리에 있어야 한다.
- ~/.bash_profile, /etc/bashrc, ~/.bashrc, /etc/skel/.bash_profile
: /etc/skel/.bashrc_profile 파일은 없어도 되는듯 하다.

o .bashrc 파일을 홈디렉토리에 만들었는데 잘 안된다면 아래 3가지를 확인해 보자
- /etc/passwd와 echo $SHELL, echo ~ 값이 같은지 확인
- .bashrc파일의 읽기 권한 확인
- .bashrc파일의 끝에서 에러가 나는지 확인
- .bashrc_profile이 홈 디렉토리에 있어야 한다.

------------------------------------------------------------------------
#~/.bash_profile

# Startup file for bash login shells.
#

LOGIN_SHELL=true

# If the user has her own init file, then use that one, else use the
# canonical one.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/lib:/usr/sbin:/usr
/bin:/wimax/utils
BASH_ENV=$HOME/.bashrc
USERNAME=""

export USERNAME BASH_ENV PATH
------------------------------------------------------------------------
# ~/.bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# Read first /etc/inputrc if the variable is not defined, and after
# the /etc/inputrc include the ~/.inputrc


[ -z $INPUTRC ] && export INPUTRC=/etc/inputrc

# set locale
#export LANG=ko

# User specific aliases and functions
#alias rm='rm -i'
alias ll='ls -l'
alias c='clear'
alias h='history'
------------------------------------------------------------------------
# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# are we an interactive shell?
if [ "$PS1" ]; then
if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
stty erase `tput kbs`
fi
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
PS1="[\u@\h \W]\\$ "
fi
------------------------------------------------------------------------
#~/.bash_profile

# Startup file for bash login shells.
#

LOGIN_SHELL=true

# If the user has her own init file, then use that one, else use the

# canonical one.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/lib
BASH_ENV=$HOME/.bashrc
USERNAME=""

export USERNAME BASH_ENV PATH
------------------------------------------------------------------------