차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 | |||
| linuxfromscratch [2025/12/21 18:45] – [PS1 설정] baecy | linuxfromscratch [2025/12/21 18:46] (현재) – [PS1 설정] baecy | ||
|---|---|---|---|
| 줄 238: | 줄 238: | ||
| < | < | ||
| - | === 최초 === | ||
| - | ++++ 많이 지저분하고 번거로움 | + | === 2차 개선 === |
| - | < | + | ++++ 별거아닌데 쓸데없이 길어짐| |
| - | touch $LFS/ | + | <code bash> |
| - | ~/.bashrc\\ | + | PS1_ROOT=' |
| - | <code lang=bash> | + | PS1_USER=' |
| - | if [ -f / | + | PS1_HEAD=' |
| - | PS1=' | + | if [ "$(awk ' |
| + | if [ $(id -u) -eq 0 ] ; then | ||
| + | PS1="< | ||
| + | else | ||
| + | PS1="< | ||
| + | fi | ||
| else | else | ||
| - | PS1='\[$(tput setaf 75)\]\[$(tput setaf 229)\]\u\[$(tput setaf 199)\]@\[$(tput setaf 215)\]\h \[$(tput setaf 75)\]\w \[$(tput sgr0)\]\$\n' | + | if [ $(id -u) -eq 0 ] ; then |
| - | fi</ | + | PS1="${PS1_HEAD}${PS1_ROOT}" |
| + | else | ||
| + | PS1="${PS1_HEAD}${PS1_USER}" | ||
| + | fi | ||
| + | fi | ||
| + | </ | ||
| ++++ | ++++ | ||
| - | |||
| === 1차 개선 === | === 1차 개선 === | ||
| 줄 269: | 줄 277: | ||
| </ | </ | ||
| ++++ | ++++ | ||
| + | === 최초 === | ||
| - | === 2차 개선 === | + | ++++ 많이 지저분하고 번거로움 |
| - | ++++ 별거아닌데 쓸데없이 길어짐| | + | < |
| - | <code bash> | + | touch $LFS/ |
| - | PS1_ROOT=' | + | ~/.bashrc\\ |
| - | PS1_USER=' | + | <code lang=bash> |
| - | PS1_HEAD=' | + | if [ -f / |
| - | if [ "$(awk ' | + | PS1=' |
| - | if [ $(id -u) -eq 0 ] ; then | + | |
| - | PS1="< | + | |
| - | else | + | |
| - | PS1="< | + | |
| - | fi | + | |
| else | else | ||
| - | if [ $(id -u) -eq 0 ] ; then | + | PS1='\[$(tput setaf 75)\]\[$(tput setaf 229)\]\u\[$(tput setaf 199)\]@\[$(tput setaf 215)\]\h \[$(tput setaf 75)\]\w \[$(tput sgr0)\]\$\n' |
| - | PS1="${PS1_HEAD}${PS1_ROOT}" | + | fi</ |
| - | else | + | |
| - | PS1="${PS1_HEAD}${PS1_USER}" | + | |
| - | fi | + | |
| - | fi | + | |
| - | </ | + | |
| ++++ | ++++ | ||
| ---- | ---- | ||