Shell: removed bash support.
parent
3ffd37a2a4
commit
0230ce4767
|
@ -1 +0,0 @@
|
|||
[ -f "$HOME/.bashrc" ] && . .bashrc
|
27
.bashrc
27
.bashrc
|
@ -1,27 +0,0 @@
|
|||
################################################################################
|
||||
## Shell Config -- Master File
|
||||
## Date 2012-08-11
|
||||
################################################################################
|
||||
|
||||
##==============================================================================
|
||||
## If not running interactively, don't do anything
|
||||
##==============================================================================
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
##==============================================================================
|
||||
## Sourcing
|
||||
##==============================================================================
|
||||
|
||||
SHELL_CURRENT="$(ps -o command="" $$)"
|
||||
SHELL_DIR="$HOME/.shell.d"
|
||||
|
||||
## Should be sourced first.
|
||||
source "${SHELL_DIR}/main_rc"
|
||||
source "${SHELL_DIR}/colors_bash"
|
||||
source "${SHELL_DIR}/options_bash"
|
||||
|
||||
## Source order should not matter.
|
||||
source "${SHELL_DIR}/alias_rc"
|
||||
source "${SHELL_DIR}/funs_rc"
|
||||
source "${SHELL_DIR}/funs_bash"
|
||||
source "${SHELL_DIR}/personal_rc"
|
|
@ -1,77 +0,0 @@
|
|||
## -*- mode:sh -*- #
|
||||
##==============================================================================
|
||||
## Colors for universal support
|
||||
##==============================================================================
|
||||
|
||||
## Reset
|
||||
Color_Off='\[\e[0m\]' # Text Reset
|
||||
|
||||
## Regular Colors
|
||||
Black='\[\e[0;30m\]' # Black
|
||||
Red='\[\e[0;31m\]' # Red
|
||||
Green='\[\e[0;32m\]' # Green
|
||||
Yellow='\[\e[0;33m\]' # Yellow
|
||||
Blue='\[\e[0;34m\]' # Blue
|
||||
Purple='\[\e[0;35m\]' # Purple
|
||||
Cyan='\[\e[0;36m\]' # Cyan
|
||||
White='\[\e[0;37m\]' # White
|
||||
|
||||
## Bold
|
||||
BBlack='\[\e[1;30m\]' # Black
|
||||
BRed='\[\e[1;31m\]' # Red
|
||||
BGreen='\[\e[1;32m\]' # Green
|
||||
BYellow='\[\e[1;33m\]' # Yellow
|
||||
BBlue='\[\e[1;34m\]' # Blue
|
||||
BPurple='\[\e[1;35m\]' # Purple
|
||||
BCyan='\[\e[1;36m\]' # Cyan
|
||||
BWhite='\[\e[1;37m\]' # White
|
||||
|
||||
## Underline
|
||||
UBlack='\[\e[4;30m\]' # Black
|
||||
URed='\[\e[4;31m\]' # Red
|
||||
UGreen='\[\e[4;32m\]' # Green
|
||||
UYellow='\[\e[4;33m\]' # Yellow
|
||||
UBlue='\[\e[4;34m\]' # Blue
|
||||
UPurple='\[\e[4;35m\]' # Purple
|
||||
UCyan='\[\e[4;36m\]' # Cyan
|
||||
UWhite='\[\e[4;37m\]' # White
|
||||
|
||||
## Background
|
||||
On_Black='\[\e[40m\]' # Black
|
||||
On_Red='\[\e[41m\]' # Red
|
||||
On_Green='\[\e[42m\]' # Green
|
||||
On_Yellow='\[\e[43m\]' # Yellow
|
||||
On_Blue='\[\e[44m\]' # Blue
|
||||
On_Purple='\[\e[45m\]' # Purple
|
||||
On_Cyan='\[\e[46m\]' # Cyan
|
||||
On_White='\[\e[47m\]' # White
|
||||
|
||||
## High Intensty
|
||||
IBlack='\[\e[0;90m\]' # Black
|
||||
IRed='\[\e[0;91m\]' # Red
|
||||
IGreen='\[\e[0;92m\]' # Green
|
||||
IYellow='\[\e[0;93m\]' # Yellow
|
||||
IBlue='\[\e[0;94m\]' # Blue
|
||||
IPurple='\[\e[0;95m\]' # Purple
|
||||
ICyan='\[\e[0;96m\]' # Cyan
|
||||
IWhite='\[\e[0;97m\]' # White
|
||||
|
||||
## Bold High Intensty
|
||||
BIBlack='\[\e[1;90m\]' # Black
|
||||
BIRed='\[\e[1;91m\]' # Red
|
||||
BIGreen='\[\e[1;92m\]' # Green
|
||||
BIYellow='\[\e[1;93m\]' # Yellow
|
||||
BIBlue='\[\e[1;94m\]' # Blue
|
||||
BIPurple='\[\e[1;95m\]' # Purple
|
||||
BICyan='\[\e[1;96m\]' # Cyan
|
||||
BIWhite='\[\e[1;97m\]' # White
|
||||
|
||||
## High Intensty backgrounds
|
||||
On_IBlack='\[\e[0;100m\]' # Black
|
||||
On_IRed='\[\e[0;101m\]' # Red
|
||||
On_IGreen='\[\e[0;102m\]' # Green
|
||||
On_IYellow='\[\e[0;103m\]' # Yellow
|
||||
On_IBlue='\[\e[0;104m\]' # Blue
|
||||
On_IPurple='\[\e[10;95m\]' # Purple
|
||||
On_ICyan='\[\e[0;106m\]' # Cyan
|
||||
On_IWhite='\[\e[0;107m\]' # White
|
|
@ -15,6 +15,4 @@ if [ "zsh" = "$SHELL_CURRENT" ]; then
|
|||
compdef _pcc pql
|
||||
compdef _tex ltx
|
||||
compdef _zathura zat
|
||||
elif [ "bash" = "$SHELL_CURRENT" ]; then
|
||||
complete -o default -o nospace -F _pacman pacman-color
|
||||
fi
|
||||
|
|
|
@ -1,232 +0,0 @@
|
|||
## -*- mode:sh -*- #
|
||||
################################################################################
|
||||
## Bash specific functions
|
||||
## WARNING: this file needs a serious update and rewrite!
|
||||
################################################################################
|
||||
|
||||
##==============================================================================
|
||||
## Browse History
|
||||
##==============================================================================
|
||||
|
||||
## Parameters usage -- should be set before sourcing the function.
|
||||
if [ -d "$SHELLDIR" ]; then
|
||||
BHISTORY="${SHELLDIR}/bhistory"
|
||||
else
|
||||
BHISTORY="$HOME/.bhistory"
|
||||
fi
|
||||
BHISTFILESIZE=20
|
||||
BHISTREVERT=true
|
||||
BHISTLOADLAST=true
|
||||
|
||||
|
||||
## Where to store the history file.
|
||||
if [ "$BHISTORY" == "" ]; then
|
||||
if [ -d "$SHELLDIR" ]; then
|
||||
BHISTORY="${SHELLDIR}/bhistory"
|
||||
else
|
||||
BHISTORY="$HOME/.bhistory"
|
||||
fi
|
||||
fi
|
||||
|
||||
## History prompted to the user.
|
||||
## BHISTFILESIZE +1 entry are stored, the additional one
|
||||
## is for the current directory to be remembered for new session.
|
||||
[ "$BHISTFILESIZE" == "" ] && BHISTFILESIZE=20
|
||||
|
||||
## If true, first listed is last browsed.
|
||||
[ "$BHISTREVERT" == "" ] && BHISTREVERT=true
|
||||
|
||||
## Go back to previous folder when starting a new session.
|
||||
[ "$BHISTLOADLAST" == "" ] && BHISTLOADLAST=true
|
||||
|
||||
|
||||
## Prevent infinite recursiveness when sourcing multiple times.
|
||||
unalias cd>/dev/null 2>&1
|
||||
|
||||
## SEED is used to generate uniq filenames.
|
||||
SEED=$(date "+%y-%m-%d-%H%M%S")
|
||||
|
||||
## Makes sure destination folder exists.
|
||||
mkdir -p $(dirname "$BHISTORY")
|
||||
|
||||
## Use 'head' or 'tail' depending on BHISTREVERT
|
||||
if $BHISTREVERT; then
|
||||
BFUNC=head
|
||||
BFUNCREV=tail
|
||||
touch "${BHISTORY}-true"
|
||||
if [ -e "$BHISTORY" -a -e "${BHISTORY}-false" ]; then
|
||||
rm -rf "${BHISTORY}-false"
|
||||
touch "${BHISTORY}-${SEED}_REV"
|
||||
tac "$BHISTORY" > "${BHISTORY}_${SEED}_REV"
|
||||
cat "${BHISTORY}_${SEED}_REV" > "$BHISTORY"
|
||||
rm -rf "${BHISTORY}_${SEED}_REV"
|
||||
fi
|
||||
else
|
||||
BFUNC=tail
|
||||
BFUNCREV=head
|
||||
touch "${BHISTORY}-false"
|
||||
if [ -e "$BHISTORY" -a -e "${BHISTORY}-true" ]; then
|
||||
rm -rf "${BHISTORY}-true"
|
||||
touch "${BHISTORY}-${SEED}_REV"
|
||||
tac "$BHISTORY" > "${BHISTORY}_${SEED}_REV"
|
||||
cat "${BHISTORY}_${SEED}_REV" > "$BHISTORY"
|
||||
rm -rf "${BHISTORY}_${SEED}_REV"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
## Go back to previous folder when starting a new session.
|
||||
## Need to put this part before the new 'cd' is set to prevent $HOME from being added as last entry in the history.
|
||||
if [ $BHISTLOADLAST -a -e $BHISTORY ]; then
|
||||
LASTPATH="$($BFUNC -n1 $BHISTORY)"
|
||||
if [[ -e "$LASTPATH" ]]; then
|
||||
cd "$LASTPATH"
|
||||
fi
|
||||
unset LASTPATH
|
||||
fi
|
||||
|
||||
|
||||
function bcd(){
|
||||
## First character is an hyphen.
|
||||
if [ "${1:0:1}" == "-" ]; then
|
||||
if [ ${#1} -eq 1 ]; then # cd -
|
||||
cd -
|
||||
else
|
||||
DEST=${1:1} # After the hyphen
|
||||
|
||||
# Check if the content after the hyphen is a number.
|
||||
if [[ $DEST == ${DEST//[^0-9]/} ]]; then
|
||||
let DEST=$DEST # Set DEST as an integer only here to avoid errors.
|
||||
|
||||
if $BHISTREVERT; then
|
||||
let DEST=${DEST}+1
|
||||
fi
|
||||
|
||||
NEWPATH=$(head -n$DEST "$BHISTORY"|tail -n1)
|
||||
echo ${NEWPATH}
|
||||
cd "${NEWPATH}"
|
||||
else
|
||||
cd "$1"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -z "$1" ]; then
|
||||
cd
|
||||
else
|
||||
cd "$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
## Let's update the history.
|
||||
touch $BHISTORY
|
||||
|
||||
## A buffer is used to avoid flow errors.
|
||||
if $BHISTREVERT; then
|
||||
echo ${PWD} >> "${BHISTORY}_$SEED"
|
||||
cat "$BHISTORY" >> "${BHISTORY}_$SEED"
|
||||
else
|
||||
cat "$BHISTORY" >> "${BHISTORY}_$SEED"
|
||||
echo "${PWD}" >> "${BHISTORY}_$SEED"
|
||||
fi
|
||||
|
||||
## The 'awk' command makes sure there is duplicates.
|
||||
## If the history size is beyond the limit set by $BHISTFILESIZE+1, it is cut.
|
||||
## The '+1' is for storing the current folder which is not displayed to the used.
|
||||
let BHISTSIZEREAL=${BHISTFILESIZE}+1
|
||||
awk ' !x[$0]++' "${BHISTORY}_$SEED" | $BFUNC -n $BHISTSIZEREAL > "$BHISTORY"
|
||||
|
||||
rm "${BHISTORY}_$SEED"
|
||||
}
|
||||
|
||||
function bhistory(){
|
||||
if [ ! -e "$BHISTORY" ]; then
|
||||
echo "Browse history empty"
|
||||
else
|
||||
let BHISTDISPLAY=$(cat "$BHISTORY"| wc -l)-1
|
||||
$BFUNCREV -n$BHISTDISPLAY "$BHISTORY"| cat -n
|
||||
fi
|
||||
}
|
||||
|
||||
## Clean -- buggy?
|
||||
#unset BFUNC BFUNCREV SEED BHISTSIZEREAL
|
||||
|
||||
## Replace 'cd' command
|
||||
alias cd='bcd'
|
||||
|
||||
shopt -s extglob ## To allow bash to understand generic expression
|
||||
shopt -s progcomp ## To enable the programmable completion
|
||||
set +o nounset ## Otherwise some completions will fail
|
||||
complete -A directory cd
|
||||
|
||||
|
||||
##==============================================================================
|
||||
## Alias auto completion
|
||||
##==============================================================================
|
||||
## wrap_alias takes three arguments:
|
||||
## $1: The name of the alias
|
||||
## $2: The command used in the alias
|
||||
## $3: The arguments in the alias all in one string
|
||||
## Generate a wrapper completion function (completer) for an alias
|
||||
## based on the command and the given arguments, if there is a
|
||||
## completer for the command, and set the wrapper as the completer for
|
||||
## the alias.
|
||||
|
||||
#function wrap_alias() {
|
||||
# [[ "$#" == 3 ]] || return 1
|
||||
#
|
||||
# local alias_name="$1"
|
||||
# local aliased_command="$2"
|
||||
# local alias_arguments="$3"
|
||||
# local num_alias_arguments=$(echo "$alias_arguments" | wc -w)
|
||||
#
|
||||
# ## The completion currently being used for the aliased command.
|
||||
# local completion=$(complete -p $aliased_command 2> /dev/null)
|
||||
#
|
||||
# ## Only a completer based on a function can be wrapped so look for -F
|
||||
# ## in the current completion. This check will also catch commands
|
||||
# ## with no completer for which $completion will be empty.
|
||||
# echo $completion | grep -q -- -F || return 0
|
||||
#
|
||||
# local namespace=alias_completion::
|
||||
#
|
||||
# ## Extract the name of the completion function from a string that
|
||||
# ## looks like: something -F function_name something
|
||||
# ## First strip the beginning of the string up to the function name by
|
||||
# ## removing "* -F " from the front.
|
||||
# local completion_function=${completion##* -F }
|
||||
# ## Then strip " *" from the end, leaving only the function name.
|
||||
# completion_function=${completion_function%% *}
|
||||
#
|
||||
# ## Try to prevent an infinite loop by not wrapping a function
|
||||
# ## generated by this function. This can happen when the user runs
|
||||
# ## this twice for an alias like ls='ls --color=auto' or alias l='ls'
|
||||
# ## and alias ls='l foo'
|
||||
# [[ "${completion_function#$namespace}" != $completion_function ]] && return 0
|
||||
#
|
||||
# local wrapper_name="${namespace}${alias_name}"
|
||||
#
|
||||
# eval "
|
||||
#function ${wrapper_name}() {
|
||||
# let COMP_CWORD+=$num_alias_arguments
|
||||
# args=( \"${alias_arguments}\" )
|
||||
# COMP_WORDS=( $aliased_command \${args[@]} \${COMP_WORDS[@]:1} )
|
||||
# $completion_function
|
||||
# }
|
||||
#"
|
||||
#
|
||||
# ## To create the new completion we use the old one with two
|
||||
# ## replacements:
|
||||
# ## 1) Replace the function with the wrapper.
|
||||
# local new_completion=${completion/-F * /-F $wrapper_name }
|
||||
# ## 2) Replace the command being completed with the alias.
|
||||
# new_completion="${new_completion% *} $alias_name"
|
||||
#
|
||||
# eval "$new_completion"
|
||||
#}
|
||||
|
||||
## For each defined alias, extract the necessary elements and use them
|
||||
## to call wrap_alias.
|
||||
#eval "$(alias -p | sed -e 's/alias \([^=][^=]*\)='\''\([^ ][^ ]*\) *\(.*\)'\''/wrap_alias \1 \2 '\''\3'\'' /')"
|
||||
|
||||
#unset wrap_alias
|
|
@ -1,205 +0,0 @@
|
|||
## -*- mode:sh -*- #
|
||||
################################################################################
|
||||
## Bash specific options
|
||||
################################################################################
|
||||
|
||||
## Enable programmable completion features (you don't need to enable
|
||||
## this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
## sources /etc/bash.bashrc).
|
||||
[ -f /etc/bash_completion ] && . /etc/bash_completion
|
||||
|
||||
## Sudo completion
|
||||
complete -cf sudo
|
||||
|
||||
set +o nounset # Otherwise some completions will fail
|
||||
set completion-ignore-case on
|
||||
set show-all-if-ambiguous on
|
||||
|
||||
## Use TAB to switch between completions instead of waiting for the next character.
|
||||
#bind '"\t":menu-complete'
|
||||
|
||||
## A list of suffixes to ignore when performing filename completion
|
||||
export FIGNORE=".o:~"
|
||||
|
||||
## To search and fill the complete name of a file (with <Esc>)
|
||||
set filec
|
||||
|
||||
##==============================================================================
|
||||
## History management
|
||||
##==============================================================================
|
||||
|
||||
# Don't put duplicate lines in the history. See bash(1) for more options.
|
||||
export HISTCONTROL=ignoredups
|
||||
|
||||
# Define number of previous commands stored.
|
||||
export HISTFILESIZE=1000
|
||||
|
||||
export HISTIGNORE="&:bg:fg:ll:h:ls:la:la:lk:clear:exit:history"
|
||||
export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S_%a "
|
||||
|
||||
##==============================================================================
|
||||
## Various options
|
||||
##==============================================================================
|
||||
|
||||
set -o notify # Jobs notify shell about their states immediately.
|
||||
#set ignoreeof # To avoid accidentally quitting the shell with <Ctrl-D>.
|
||||
#shopt -u mailwarn # Disable the shell ability to warn about incoming mail.
|
||||
shopt -s cdable_vars # If cd arg is not valid, assumes its a var defining a dir.
|
||||
shopt -s cdspell # To correct minor error in the directory spelling (during cd).
|
||||
shopt -s checkhash
|
||||
shopt -s checkwinsize # Update the value of LINES and COLUMNS after each command if altered.
|
||||
shopt -s cmdhist # Save multi-line commands in history as single line.
|
||||
shopt -s dirspell
|
||||
shopt -s dotglob # Include dotfiles in pathname expansion.
|
||||
shopt -s expand_aliases # Expand aliases.
|
||||
shopt -s extglob # Enable extended pattern-matching features.
|
||||
shopt -s histappend # Append to (not overwrite) the history file.
|
||||
shopt -s hostcomplete # Attempt hostname expansion when @ is at the beginning of a word.
|
||||
shopt -s no_empty_cmd_completion # No completion on an empty line.
|
||||
shopt -s nocaseglob # Pathname expansion will be treated as case-insensitive.
|
||||
shopt -s progcomp # To enable the programmable completion.
|
||||
|
||||
##==============================================================================
|
||||
## Various options
|
||||
##==============================================================================
|
||||
|
||||
complete -A setopt set
|
||||
complete -A hostname ssh rsh rcp telnet rlogin r ftp ping disk
|
||||
complete -A export export printenv
|
||||
complete -A variable export local readonly unset
|
||||
complete -A enabled builtin
|
||||
complete -A alias alias unalias
|
||||
complete -A function function
|
||||
complete -A user su mail finger my_ps my_detail_ps
|
||||
complete -A helptopic help # currently same as builtins
|
||||
complete -A shopt shopt
|
||||
complete -A stopped -P '%' bg
|
||||
complete -A job -P '%' fg jobs disown
|
||||
complete -A directory rmdir
|
||||
#complete -A directory -o default cd
|
||||
complete -A command which
|
||||
complete -A signal kill killall
|
||||
|
||||
# File name completion according to program functionnality
|
||||
complete -A file -X '!*.@(zip|ZIP|jar|JAR)' unzip zipinfo
|
||||
complete -A file -X '!*.@(z|Z)' uncompress
|
||||
complete -A file -X '!*.@(gz|GZ)' gunzip
|
||||
complete -A file -X '!*.@(bz2|BZ2)' bunzip2 untar
|
||||
complete -A file -X '!*.@(tar|TAR)' untar
|
||||
|
||||
##==============================================================================
|
||||
## PS1 -- Full width bar with informations.
|
||||
##==============================================================================
|
||||
|
||||
## An external function is needed to update $COLUMNS value, as well as path, time, and other variables.
|
||||
_psbar ()
|
||||
{
|
||||
## Initialization.
|
||||
BARCOLOR=$BBlue
|
||||
OUTPUT="$BARCOLOR["
|
||||
SYMBOLVAR='='
|
||||
CENTERVAR=" $(date +%H:%M:%S) "
|
||||
|
||||
## Truncated path.
|
||||
## '3' stands for '[ $SYMBOLVAR'.
|
||||
local PWDMAXLEN=$(($COLUMNS/2-${#CENTERVAR}/2-3))
|
||||
local TRUNC_SYMBOL="..."
|
||||
if [[ $PWD == $HOME* ]]; then
|
||||
newPWD="~${PWD#$HOME}"
|
||||
else
|
||||
newPWD=${PWD}
|
||||
fi
|
||||
if [ ${#newPWD} -gt $PWDMAXLEN ]; then
|
||||
local PWDOFFSET=$(( ${#newPWD} - $PWDMAXLEN + ${#TRUNC_SYMBOL} ))
|
||||
newPWD="${TRUNC_SYMBOL}${newPWD:$PWDOFFSET:$PWDMAXLEN}"
|
||||
fi
|
||||
|
||||
## Truncated login information.
|
||||
local LOGINFO="$(whoami)@$HOSTNAME"
|
||||
if [ ${#LOGINFO} -gt $(($COLUMNS/2-${#CENTERVAR}/2-3)) ]
|
||||
then
|
||||
LOGINFO=$USER
|
||||
if [ ${#LOGINFO} -gt $(($COLUMNS/2-${#CENTERVAR}/2-3)) ]
|
||||
then
|
||||
unset LOGINFO
|
||||
fi
|
||||
fi
|
||||
|
||||
## Left and right side. Empty if terminal width is too small.
|
||||
if [ $COLUMNS -gt 50 ]
|
||||
then
|
||||
LEFTSIDEVAR="$newPWD "
|
||||
RIGHTSIDEVAR=" $LOGINFO"
|
||||
fi
|
||||
|
||||
## Left side.
|
||||
OUTPUT="$OUTPUT$BPurple$LEFTSIDEVAR"
|
||||
|
||||
|
||||
## Reset bar color
|
||||
OUTPUT="$OUTPUT$BARCOLOR"
|
||||
|
||||
## In case of odd values.
|
||||
if [ $(($COLUMNS%2)) -eq 1 ]
|
||||
then
|
||||
OUTPUT="$OUTPUT$SYMBOLVAR"
|
||||
fi
|
||||
|
||||
## Fill 'OUTPUT' variable with the desired chars.
|
||||
## '1' stands for '['
|
||||
for i in $( seq $(($COLUMNS/2-${#LEFTSIDEVAR}-${#CENTERVAR}/2-1)) )
|
||||
do
|
||||
OUTPUT="$OUTPUT$SYMBOLVAR"
|
||||
done
|
||||
|
||||
## Center.
|
||||
OUTPUT="$OUTPUT$Color_Off$CENTERVAR"
|
||||
|
||||
## Reset bar color
|
||||
OUTPUT="$OUTPUT$BARCOLOR"
|
||||
|
||||
## Fill 'OUTPUT' variable with the desired chars.
|
||||
for i in $( seq $(($COLUMNS/2-${#CENTERVAR}/2-${#RIGHTSIDEVAR}-1)) )
|
||||
do
|
||||
OUTPUT="$OUTPUT$SYMBOLVAR"
|
||||
done
|
||||
|
||||
## Right side.
|
||||
OUTPUT="$OUTPUT$BGreen$RIGHTSIDEVAR"
|
||||
|
||||
## Reset bar color
|
||||
OUTPUT="$OUTPUT$BARCOLOR"
|
||||
|
||||
## Close bar
|
||||
OUTPUT="$OUTPUT]\n"
|
||||
|
||||
## Prompt.
|
||||
if [ $(id -u) -eq 0 ]
|
||||
then
|
||||
## Root access
|
||||
OUTPUT="$OUTPUT$BRed# $Color_Off"
|
||||
else
|
||||
## Normal user
|
||||
OUTPUT="$OUTPUT$BYellow$ $Color_Off"
|
||||
fi
|
||||
|
||||
## Set result to PS1.
|
||||
PS1="$OUTPUT"
|
||||
}
|
||||
|
||||
|
||||
##==============================================================================
|
||||
## Add informations to history.
|
||||
##==============================================================================
|
||||
#PROMPT_COMMAND='hpwd=$(history 1); hpwd="${hpwd# *[0-9]* }"; if [[ ${hpwd%% *} == "cd" ]]; then cwd=$OLDPWD; else cwd=$PWD; fi; hpwd="${hpwd% ### *} ### $cwd"; history -s "$hpwd;"'
|
||||
|
||||
##==============================================================================
|
||||
## PS1
|
||||
##==============================================================================
|
||||
|
||||
## PS1 using _psbar function.
|
||||
#PROMPT_COMMAND='_psbar'
|
||||
|
||||
## Simple PS1
|
||||
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] '
|
||||
|
Loading…
Reference in New Issue