User:Mattx86/Bash Profile: Difference between revisions

From Alpine Linux
m (Replaced space-tabs with regular tabs)
mNo edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
Here's the <code>~/.bash_profile</code> that I use:
Here's the <code>~/.bash_profile</code> that I use:


<pre>alias apk='apk --progress'
<pre>
# Aliases
alias sudo='sudo ' # sudo: make aliases work
alias nano='nano -wcAiLS' # nano: -w: don't wrap long lines
#      -c: constantly show cursor position
# -A: enable smart home key
# -i: automatically indent new lines
# -L: don't add newlines to the ends of files
# -S: scroll by line instead of half-screen
alias apk='apk --progress' # apk: show progress bar


# Shell Options
shopt -s checkwinsize
# Color Definitions for .bashrc
COL_YEL="\[\e[1;33m\]"
COL_YEL="\[\e[1;33m\]"
COL_GRA="\[\e[0;37m\]"
COL_GRA="\[\e[0;37m\]"
Line 9: Line 22:
COL_RED="\[\e[1;31m\]"
COL_RED="\[\e[1;31m\]"


# Bash Prompt
if test "$UID" -eq 0 ; then
if test "$UID" -eq 0 ; then
_COL_USER=$COL_RED
_COL_USER=$COL_RED
Line 16: Line 30:
_p=">"
_p=">"
fi
fi
COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${COL_USER}${_p} \[\e[m\]"
COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]"
case $TERM in
case $TERM in
*term | rxvt )
*term | rxvt | screen )
PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;;
PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;;
linux )
linux )
Line 25: Line 39:
PS1="\u@\h:\w${_p} " ;;
PS1="\u@\h:\w${_p} " ;;
esac
esac
shopt -s checkwinsize</pre>
</pre>
 
{{Tip|Be sure to symlink <code>.bashrc</code> to <code>.bash_profile</code>.}}

Latest revision as of 12:27, 26 January 2011

Here's the ~/.bash_profile that I use:

# Aliases
alias sudo='sudo '		# sudo: make aliases work
alias nano='nano -wcAiLS'	# nano: -w: don't wrap long lines
				#       -c: constantly show cursor position
				#	-A: enable smart home key
				#	-i: automatically indent new lines
				#	-L: don't add newlines to the ends of files
				#	-S: scroll by line instead of half-screen
alias apk='apk --progress'	# apk: show progress bar

# Shell Options
shopt -s checkwinsize

# Color Definitions for .bashrc
COL_YEL="\[\e[1;33m\]"
COL_GRA="\[\e[0;37m\]"
COL_WHI="\[\e[1;37m\]"
COL_GRE="\[\e[1;32m\]"
COL_RED="\[\e[1;31m\]"

# Bash Prompt
if test "$UID" -eq 0 ; then
	_COL_USER=$COL_RED
	_p=" #"
else
	_COL_USER=$COL_GRE
	_p=">"
fi
COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]"
case $TERM in
	*term | rxvt | screen )
		PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;;
	linux )
		PS1="${COLORIZED_PROMPT}" ;;
	* )
		PS1="\u@\h:\w${_p} " ;;
esac
Tip: Be sure to symlink .bashrc to .bash_profile.