minor improvements and better coding style in all prompts and truncpwd

parent f9b854a4
......@@ -17,29 +17,26 @@ case ${1} in
;;
* )
newsepacolor=$(echo $sepacolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
newwdircolor=$(echo $wdircolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
newpscolor=$(echo $pscolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
[[ ! ${dirchar} ]] && dirchar="/"
[[ ! ${trunc_symbol} ]] && trunc_symbol="«"
[[ ! ${trunc_length} ]] && trunc_length=25
if [[ ${enable_colors} == "True" && ${pstyle_supported} == "True" ]]; then
if [[ $pwdmaxlen != 0 && ${#PWD} -gt $pwdmaxlen ]]; then
pwdoffset=$(( ${#PWD} - $pwdmaxlen ))
xPWD="$newpscolor${trunc_symbol}${PWD:$pwdoffset:$pwdmaxlen}"
newPWD="${xPWD//\//$newsepacolor$dirchar$newwdircolor}"
if [[ ${enable_colors} == True && ${truncpwd_supported} == True ]]; then
if [[ ${pwdmaxlen} != 0 && ${#PWD} -gt ${pwdmaxlen} ]]; then
pwdoffset=$(( ${#PWD} - ${pwdmaxlen} ))
xPWD="${epscolor}${trunc_symbol}${PWD:${pwdoffset}:${pwdmaxlen}}"
newPWD="${xPWD//\//${esepacolor}${dirchar}${ewdircolor}}"
else
newPWD="${PWD//\//$newsepacolor$dirchar$newwdircolor}"
newPWD="${PWD//\//${esepacolor}${dirchar}${ewdircolor}}"
fi
else
if [[ $pwdmaxlen != 0 && ${#PWD} -gt $pwdmaxlen ]]; then
pwdoffset=$(( ${#PWD} - $pwdmaxlen ))
xPWD="${trunc_symbol}${PWD:$pwdoffset:$pwdmaxlen}"
newPWD="${xPWD//\//$dirchar}"
if [[ ${pwdmaxlen} != 0 && ${#PWD} -gt ${pwdmaxlen} ]]; then
pwdoffset=$(( ${#PWD} - ${pwdmaxlen} ))
xPWD="${trunc_symbol}${PWD:${pwdoffset}:${pwdmaxlen}}"
newPWD="${xPWD//\//${dirchar}}"
else
newPWD="${PWD//\//$dirchar}"
newPWD="${PWD//\//${dirchar}}"
fi
fi
......
......@@ -11,7 +11,7 @@
#########################################################
user="whoami"
host=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
host=$(echo -n ${HOSTNAME} | sed -e "s/[\.].*//")
function pre_prompt {
......@@ -22,12 +22,12 @@ let promptsize=$(echo -n "--( $user @ $host ddd., DD mmm YY )( ${PWD} )--" | wc
let fillsize=${COLUMNS}-${promptsize}
fill=""
while [ "$fillsize" -gt "0" ]
while [ "${fillsize}" -gt "0" ]
do
fill="${fill}─"
let fillsize=${fillsize}-1
done
if [ "$fillsize" -lt "0" ]
if [ "${fillsize}" -lt "0" ]
then
let cutt=3-${fillsize}
xPWD="...${PWD:${cutt}}"
......@@ -39,13 +39,13 @@ PRE_PROMPT_COMMAND
PROMPT_COMMAND=pre_prompt
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="$sepacolor┌─($usercolor \u$fontcolor @ $hostcolor\h\
$datecolor \$(date \"+%a, %d %b %y\")$sepacolor )─\${fill}─($wdircolor \$newPWD \
$sepacolor)─<\n$sepacolor└─($timecolor \$(date \"+%H:%M\")$usercolor \$$sepacolor )─>$fontcolor "
PS1="${sepacolor}┌─(${usercolor} \u${fontcolor} @ ${hostcolor}\h\
${datecolor} \$(date \"+%a, %d %b %y\")${sepacolor} )─\${fill}─(${wdircolor} \${newPWD} \
${sepacolor})─<\n${sepacolor}└─(${timecolor} \$(date \"+%H:%M\")${usercolor} \$${sepacolor} )─>${fontcolor} "
else PS1="┌─( \u @ \h \$(date \"+%a, %d %b %y\") )─\${fill}─( \$newPWD \
else PS1="┌─( \u @ \h \$(date \"+%a, %d %b %y\") )─\${fill}─( \${newPWD} \
)─<\n└─( \$(date \"+%H:%M\") \$ )─> "
fi
......@@ -9,26 +9,26 @@
# #
#########################################################
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
function pre_prompt {
let prompt_x=$(tput cols)-29
tput sc
tput cup 0 ${prompt_x}
echo -en "$(echo $sepacolor | sed -e 's/\\\[//g' -e 's/\\\]//g')\
[$(echo $datecolor | sed -e 's/\\\[//g' -e 's/\\\]//g') \
echo -en "$(echo ${sepacolor} | sed -e 's/\\\[//g' -e 's/\\\]//g')\
[$(echo ${datecolor} | sed -e 's/\\\[//g' -e 's/\\\]//g') \
$(date '+%a, %d %b %y')\
$(echo $sepacolor | sed -e 's/\\\[//g' -e 's/\\\]//g') ::\
$(echo $timecolor | sed -e 's/\\\[//g' -e 's/\\\]//g') $(date +%T)\
$(echo $sepacolor | sed -e 's/\\\[//g' -e 's/\\\]//g') ]"
$(echo ${sepacolor} | sed -e 's/\\\[//g' -e 's/\\\]//g') ::\
$(echo ${timecolor} | sed -e 's/\\\[//g' -e 's/\\\]//g') $(date +%T)\
$(echo ${sepacolor} | sed -e 's/\\\[//g' -e 's/\\\]//g') ]"
tput rc
PRE_PROMPT_COMMAND
}
PROMPT_COMMAND=pre_prompt
PS1="$sepacolor[$usercolor \u $fontcolor@ $hostcolor\h $pscolor: $wdircolor\$(truncpwd)$CLOCK_1_COLOR\$(CLOCK_1) $sepacolor]$fontcolor "
PS1="${sepacolor}[${usercolor} \u ${fontcolor}@ ${hostcolor}\h ${pscolor}: ${wdircolor}\$(truncpwd)$CLOCK_1_COLOR\$(CLOCK_1) ${sepacolor}]${fontcolor} "
else
......
......@@ -15,12 +15,12 @@ custom_command=$(ini_get command)
if [[ ${use_custom_prompt} == True && ${custom_prompt} != "" ]]; then
if [[ ${custom_command} != "" ]]; then
echo -E "function pre_prompt { " > ${HOME}/.custom_prompt
echo -E "$custom_command" >> ${HOME}/.custom_prompt
echo -E "${custom_command}" >> ${HOME}/.custom_prompt
echo -E "}" >> ${HOME}/.custom_prompt
echo -e "PROMPT_COMMAND=pre_prompt \n" >> ${HOME}/.custom_prompt
echo -E PS1=\"$custom_prompt\" >> ${HOME}/.custom_prompt
echo -E PS1=\"${custom_prompt}\" >> ${HOME}/.custom_prompt
else
echo -E PS1=\"$custom_prompt\" > ${HOME}/.custom_prompt
echo -E PS1=\"${custom_prompt}\" > ${HOME}/.custom_prompt
fi
source ${HOME}/.custom_prompt
fi
......@@ -9,18 +9,18 @@
# #
#########################################################
export pstyle_supported=True
export truncpwd_supported=True
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n\
$pscolor┌─$sepacolor[ $wdircolor\$(truncpwd)$DIRKS_1_COLOR\$(DIRKS_1) $sepacolor]\n\
$pscolor└─$sepacolor[ $usercolor\u $fontcolor@ $hostcolor\H $fontcolor/ $pscolor\$(systemkit tty) $sepacolor( $timecolor\t $sepacolor) $pscolor$SHLVL$DIRKS_2_COLOR\$(DIRKS_2) $sepacolor]$pscolor·>$fontcolor "
${pscolor}┌─${sepacolor}[ ${wdircolor}\$(truncpwd)${DIRKS_1_COLOR} \$(DIRKS_1) ${sepacolor}]\n\
${pscolor}└─${sepacolor}[ ${usercolor}\u ${fontcolor}@ ${hostcolor}\H ${fontcolor}/ ${pscolor}\$(systemkit tty) ${sepacolor}( ${timecolor}\t ${sepacolor}) ${pscolor}${SHLVL}${DIRKS_2_COLOR} \$(DIRKS_2) ${sepacolor}]${pscolor}·>${fontcolor} "
else
PS1="\n\
┌─[ \$(truncpwd)\$(DIRKS_1) ]\n\
└─[ \u @ \H / \$(systemkit tty) ( \t ) $SHLVL\$(DIRKS_2) ]·> "
┌─[ \$(truncpwd) \$(DIRKS_1) ]\n\
└─[ \u @ \H / \$(systemkit tty) ( \t ) ${SHLVL} \$(DIRKS_2) ]·> "
fi
......@@ -9,11 +9,11 @@
# #
#########################################################
export pstyle_supported=True
export truncpwd_supported=True
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n$pscolor.:$sepacolor[ $usercolor\u$pscolor @ $hostcolor\h$sepacolor ]$pscolor:. .:$sepacolor[ $wdircolor\$(truncpwd)$sepacolor ]$pscolor:.\n.:$sepacolor[·>$fontcolor "
PS1="\n${pscolor}.:${sepacolor}[ ${usercolor}\u${pscolor} @ ${hostcolor}\h${sepacolor} ]${pscolor}:. .:${sepacolor}[ ${wdircolor}\$(truncpwd)${sepacolor} ]${pscolor}:.\n.:${sepacolor}[·>${fontcolor} "
else
......
......@@ -9,15 +9,15 @@
# #
#########################################################
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n\
$pscolor┌─$sepacolor[ $usercolor\u $fontcolor@ $hostcolor\h$sepacolor ]$pscolor\
$sepacolor[$pscolor job #\# $sepacolor]$pscolor$sepacolor[$fontcolor \$(systemkit tty)$sepacolor ]\
$pscolor$sepacolor[ $timecolor\$(date +%H:%M:%S)\
$fontcolor : $datecolor\$(date +%m/%d/%y)$fontcolor :$upcolor \$(systemkit uptime)$sepacolor ]\n\
$pscolor└─$sepacolor[ $usercolor\$$pscolor : $wdircolor\$(truncpwd)$ELITE_1_COLOR\$(ELITE_1)$sepacolor ]\
$pscolor·>$fontcolor "
${pscolor}┌─${sepacolor}[ ${usercolor}\u ${fontcolor}@ ${hostcolor}\h${sepacolor} ]${pscolor}\
${sepacolor}[${pscolor} job #\# ${sepacolor}]${pscolor}${sepacolor}[${fontcolor} \$(systemkit tty)${sepacolor} ]\
${pscolor}${sepacolor}[ ${timecolor}\$(date +%H:%M:%S)\
${fontcolor} : ${datecolor}\$(date +%m/%d/%y)${fontcolor} :${upcolor} \$(systemkit uptime)${sepacolor} ]\n\
${pscolor}└─${sepacolor}[ ${usercolor}\$${pscolor} : ${wdircolor}\$(truncpwd)${ELITE_1_COLOR}\$(ELITE_1)${sepacolor} ]\
${pscolor}·>${fontcolor} "
else
......
......@@ -9,23 +9,23 @@
# #
#########################################################
host=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
host=$(echo -n ${HOSTNAME} | sed -e "s/[\.].*//")
dirchar=$(ini_get directory_indicator)
trunc_symbol=$(ini_get pwdcut)
trunc_length=$(($(echo $trunc_symbol | wc -m)-1))
trunc_length=$(($(echo ${trunc_symbol} | wc -m)-1))
j=4
k=6
l=8
m=10
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
esepacolor=$(echo $sepacolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
edatecolor=$(echo $datecolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
etimecolor=$(echo $timecolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
efontcolor=$(echo $fontcolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
epscolor=$(echo $pscolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
ewdircolor=$(echo $wdircolor | sed -e 's/\\\[//g' -e 's/\\\]//g')
{esepacolor}=$(echo ${sepacolor} | sed -e 's/\\\[//g' -e 's/\\\]//g')
{edatecolor}=$(echo ${datecolor} | sed -e 's/\\\[//g' -e 's/\\\]//g')
{etimecolor}=$(echo ${timecolor} | sed -e 's/\\\[//g' -e 's/\\\]//g')
{efontcolor}=$(echo ${fontcolor} | sed -e 's/\\\[//g' -e 's/\\\]//g')
{epscolor}=$(echo ${pscolor} | sed -e 's/\\\[//g' -e 's/\\\]//g')
{ewdircolor}=$(echo ${wdircolor} | sed -e 's/\\\[//g' -e 's/\\\]//g')
function pre_prompt {
......@@ -35,22 +35,22 @@ function pre_prompt {
newPWD="${PWD}"
let promptsize=$(echo -n "--( $(whoami) @ $host )--( ${PWD} )-----" | wc -c | tr -d " ")
let promptsize=$(echo -n "--( $(whoami) @ ${host} )--( ${PWD} )-----" | wc -c | tr -d " ")
let fillsize=${COLUMNS}-${promptsize}
fill=""
while [ "$fillsize" -gt "0" ]
while [ "${fillsize}" -gt "0" ]
do
fill="${fill}─"
let fillsize=${fillsize}-1
done
if [ "$fillsize" -lt "0" ]
if [ "${fillsize}" -lt "0" ]
then
let cutt=${trunc_length}-${fillsize}
xPWD="${trunc_symbol}${PWD:${cutt}}"
newPWD="${xPWD//\//$esepacolor$dirchar$ewdircolor}"
newPWD="${xPWD//\//${esepacolor}${dirchar}${ewdircolor}}"
else
newPWD="${PWD//\//$esepacolor$dirchar$ewdircolor}"
newPWD="${PWD//\//${esepacolor}${dirchar}${ewdircolor}}"
fi
PRE_PROMPT_COMMAND
......@@ -60,39 +60,39 @@ _newPWD () {
}
echo -en "\033[2;$((${COLUMNS}-29))H"
echo -en "$esepacolor($etimecolor $(date +%H:%M)$esepacolor :$edatecolor $(date '+%a, %d %b %y')$esepacolor )────┐"
echo -en "${esepacolor}(${etimecolor} $(date +%H:%M)${esepacolor} :${edatecolor} $(date '+%a, %d %b %y')${esepacolor} )────┐"
echo -en "\033[2;${COLUMNS}H"
i=${LINES}
while [ $i -ge 4 ]
while [ ${i} -ge 4 ]
do
case $i in
$j )
echo -en "\033[$j;$((${COLUMNS}-29))H"
echo -en "$esepacolor($efontcolor system-load: $(systemkit load1)$esepacolor )────────┤"
echo -en "\033[$(($i-1));${COLUMNS}H$esepacolor│"
case ${i} in
${j} )
echo -en "\033[${j};$((${COLUMNS}-29))H"
echo -en "${esepacolor}(${efontcolor} system-load: $(systemkit load1)${esepacolor} )────────┤"
echo -en "\033[$((${i}-1));${COLUMNS}H${esepacolor}│"
;;
$k )
echo -en "\033[$k;$((${COLUMNS}-29))H"
echo -en "$esepacolor($efontcolor cpu-load: $(systemkit cpuload)$esepacolor )────────────┤"
echo -en "\033[$(($i-1));${COLUMNS}H$esepacolor│"
${k} )
echo -en "\033[${k};$((${COLUMNS}-29))H"
echo -en "${esepacolor}(${efontcolor} cpu-load: $(systemkit cpuload)${esepacolor} )────────────┤"
echo -en "\033[$((${i}-1));${COLUMNS}H${esepacolor}│"
;;
$l )
echo -en "\033[$l;$((${COLUMNS}-29))H"
echo -en "$esepacolor($efontcolor ram: $esepacolor$(systemkit usedram)mb$efontcolor / $esepacolor$(systemkit freeram)mb )─────┤"
echo -en "\033[$(($i-1));${COLUMNS}H$esepacolor│"
${l} )
echo -en "\033[${l};$((${COLUMNS}-29))H"
echo -en "${esepacolor}(${efontcolor} ram: ${esepacolor}$(systemkit usedram)mb${efontcolor} / ${esepacolor}$(systemkit freeram)mb )─────┤"
echo -en "\033[$((${i}-1));${COLUMNS}H${esepacolor}│"
;;
$m )
echo -en "\033[$m;$((${COLUMNS}-29))H"
echo -en "$esepacolor($efontcolor processes:$epscolor $(systemkit processes) $esepacolor)──────────┤"
echo -en "\033[$(($i-1));${COLUMNS}H$esepacolor│"
${m} )
echo -en "\033[${m};$((${COLUMNS}-29))H"
echo -en "${esepacolor}(${efontcolor} processes:${epscolor} $(systemkit processes) ${esepacolor})──────────┤"
echo -en "\033[$((${i}-1));${COLUMNS}H${esepacolor}│"
;;
* )
echo -en "\033[$(($i-1));${COLUMNS}H$esepacolor│"
echo -en "\033[$((${i}-1));${COLUMNS}H${esepacolor}│"
;;
esac
let i=$i-1
let i=${i}-1
done
let prompt_line=${LINES}-1
......@@ -101,11 +101,11 @@ let prompt_line=${LINES}-1
PROMPT_COMMAND=pre_prompt
PS1="\[\033[\${prompt_line};0H\]\n\
$sepacolor┌─( $usercolor\u $fontcolor@ $hostcolor\h \
$sepacolor)─\${fill}─( $wdircolor\$(_newPWD)\
$sepacolor )────┘\n\
$sepacolor└─($upcolor uptime: \$(systemkit uptime)\
$fontcolor :$EQUINOX_1_COLOR\$(EQUINOX_1)$fontcolor \$$sepacolor )·>$fontcolor "
${sepacolor}┌─( ${usercolor}\u ${fontcolor}@ ${hostcolor}\h \
${sepacolor})─\${fill}─( ${wdircolor}\$(_newPWD)\
${sepacolor} )────┘\n\
${sepacolor}└─(${upcolor} uptime: \$(systemkit uptime)\
${fontcolor} :${EQUINOX_1_COLOR}\$(EQUINOX_1)${fontcolor} \$ ${sepacolor})·>${fontcolor} "
else
......@@ -117,28 +117,28 @@ function pre_prompt {
newPWD="${PWD}"
let promptsize=$(echo -n "--( $(whoami) @ $host )---( ${PWD} )-----" | wc -c | tr -d " ")
let promptsize=$(echo -n "--( $(whoami) @ ${host} )---( ${PWD} )-----" | wc -c | tr -d " ")
let fillsize=${COLUMNS}-${promptsize}
fill=""
while [ "$fillsize" -gt "0" ]
while [ "${fillsize}" -gt "0" ]
do
fill="${fill}─"
let fillsize=${fillsize}-1
done
if [ "$fillsize" -lt "0" ]
if [ "${fillsize}" -lt "0" ]
then
let cutt=${trunc_length}-${fillsize}
xPWD="${trunc_symbol}$(echo -n $PWD | sed -e \"s/\(^.\{$cutt\}\)\(.*\)/\2/\")"
newPWD="${xPWD//\//$dirchar}"
newPWD="${xPWD//\//${dirchar}}"
else
newPWD="${PWD//\//$dirchar}"
newPWD="${PWD//\//${dirchar}}"
fi
PRE_PROMPT_COMMAND
_newPWD () {
echo -e $newPWD
echo -e ${newPWD}
}
echo -en "\033[2;$((${COLUMNS}-29))H"
......@@ -147,34 +147,34 @@ echo -en "\033[2;${COLUMNS}H"
i=${LINES}
while [ $i -ge 4 ]
while [ ${i} -ge 4 ]
do
case $i in
$j )
echo -en "\033[$j;$((${COLUMNS}-29))H"
case ${i} in
${j} )
echo -en "\033[${j};$((${COLUMNS}-29))H"
echo -en "( system-load: $(systemkit load1) )────────┤"
echo -en "\033[$(($i-1));${COLUMNS}H│"
echo -en "\033[$((${i}-1));${COLUMNS}H│"
;;
$k )
echo -en "\033[$k;$((${COLUMNS}-29))H"
${k} )
echo -en "\033[${k};$((${COLUMNS}-29))H"
echo -en "( cpu-load: $(systemkit cpuload) )────────────┤"
echo -en "\033[$(($i-1));${COLUMNS}H│"
echo -en "\033[$((${i}-1));${COLUMNS}H│"
;;
$l )
echo -en "\033[$l;$((${COLUMNS}-29))H"
${l} )
echo -en "\033[${l};$((${COLUMNS}-29))H"
echo -en "( ram: $(systemkit usedram)mb / $(systemkit freeram)mb )─────┤"
echo -en "\033[$(($i-1));${COLUMNS}H│"
echo -en "\033[$((${i}-1));${COLUMNS}H│"
;;
$m )
echo -en "\033[$m;$((${COLUMNS}-29))H"
echo -en "( processes:$epscolor $(systemkit processes) )──────────┤"
echo -en "\033[$(($i-1));${COLUMNS}H│"
${m} )
echo -en "\033[${m};$((${COLUMNS}-29))H"
echo -en "( processes:${epscolor} $(systemkit processes) )──────────┤"
echo -en "\033[$((${i}-1));${COLUMNS}H│"
;;
* )
echo -en "\033[$(($i-1));${COLUMNS}H│"
echo -en "\033[$((${i}-1));${COLUMNS}H│"
;;
esac
let i=$i-1
let i=${i}-1
done
let prompt_line=${LINES}-1
......
......@@ -12,49 +12,49 @@
function prompt_command
{
local one=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g")
local five=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\).*/\2/" -e "s/ //g")
local diff1_5=$(echo -e "scale = scale ($one) \nx=$one - $five\n if (x>0) {print \"up\"} else {print \"down\"}\n print x \nquit \n" | bc)
loaddiff="$(echo -n "${one}${diff1_5}" | sed -e 's/down\-/down/g')"
local one=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g")
local five=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\).*/\2/" -e "s/ //g")
local diff1_5=$(echo -e "scale = scale ($one) \nx=$one - $five\n if (x>0) {print \"up\"} else {print \"down\"}\n print x \nquit \n" | bc)
loaddiff="$(echo -n "${one}${diff1_5}" | sed -e 's/down\-/down/g')"
let files=$(ls -l | grep "^-" | wc -l | tr -d " ")
let hiddenfiles=$(ls -l -d .* | grep "^-" | wc -l | tr -d " ")
let executables=$(ls -l | grep ^-..x | wc -l | tr -d " ")
let directories=$(ls -l | grep "^d" | wc -l | tr -d " ")
let hiddendirectories=$(ls -l -d .* | grep "^d" | wc -l | tr -d " ")-2
let linktemp=$(ls -l | grep "^l" | wc -l | tr -d " ")
if [ "$linktemp" -eq "0" ]
then
links=""
else
links=" ${linktemp}l"
fi
unset linktemp
let devicetemp=$(ls -l | grep "^[bc]" | wc -l | tr -d " ")
if [ "$devicetemp" -eq "0" ]
then
devices=""
else
devices=" ${devicetemp}bc"
fi
unset devicetemp
let files=$(ls -l | grep "^-" | wc -l | tr -d " ")
let hiddenfiles=$(ls -l -d .* | grep "^-" | wc -l | tr -d " ")
let executables=$(ls -l | grep ^-..x | wc -l | tr -d " ")
let directories=$(ls -l | grep "^d" | wc -l | tr -d " ")
let hiddendirectories=$(ls -l -d .* | grep "^d" | wc -l | tr -d " ")-2
let linktemp=$(ls -l | grep "^l" | wc -l | tr -d " ")
if [ "$linktemp" -eq "0" ]
then
links=""
else
links=" ${linktemp}l"
fi
unset linktemp
let devicetemp=$(ls -l | grep "^[bc]" | wc -l | tr -d " ")
if [ "$devicetemp" -eq "0" ]
then
devices=""
else
devices=" ${devicetemp}bc"
fi
unset devicetemp
PRE_PROMPT_COMMAND
PRE_PROMPT_COMMAND
}
PROMPT_COMMAND=prompt_command
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n\
$sepacolor[ $timecolor\$(date +%T) $fontcolor-$datecolor \$(date +%D) $sepacolor]\
$sepacolor[ $usercolor\u $fontcolor@ $hostcolor\h $sepacolor]\
$sepacolor[ $wdircolor\${files}.\${hiddenfiles}-\${executables}x \$(systemkit dirsize) \
${sepacolor}[ ${timecolor}\$(date +%T) ${fontcolor}-${datecolor} \$(date +%D) ${sepacolor}]\
${sepacolor}[ ${usercolor}\u ${fontcolor}@ ${hostcolor}\h ${sepacolor}]\
${sepacolor}[ ${wdircolor}\${files}.\${hiddenfiles}-\${executables}x \$(systemkit dirsize) \
\${directories}.\${hiddendirectories}d\${links}\${devices}\
$sepacolor ][ $upcolor\${loaddiff}$sepacolor ][ \
$pscolor\$(ps ax | wc -l | sed -e \"s: ::g\")proc $sepacolor]\
\n$sepacolor[ $wdircolor\$(truncpwd)$POW_1_COLOR\$(POW_1) $sepacolor]$fontcolor \$ "
${sepacolor} ][ ${upcolor}\${loaddiff}${sepacolor} ][ \
${pscolor}\$(ps ax | wc -l | sed -e \"s: ::g\")proc ${sepacolor}]\
\n${sepacolor}[ ${wdircolor}\$(truncpwd)${POW_1_COLOR}\$(POW_1) ${sepacolor}]${fontcolor} \$ "
else
......
......@@ -9,9 +9,9 @@
# #
#########################################################
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n$sepacolor -$pscolor( $usercolor\u$sepacolor /$hostcolor \h$pscolor )$sepacolor-$pscolor( \$(systemkit tty) )$sepacolor-$pscolor($upcolor uptime: \$(systemkit uptime)$pscolor )$sepacolor-$pscolor($timecolor \$(date +%H:%M)$datecolor \$(date +%d-%b-%y)$pscolor )$sepacolor-$pscolor($wdircolor files: \$(systemkit countvisiblefiles)$sepacolor /$wdircolor folders: \$(systemkit countvisibledirs)$pscolor )$sepacolor-\n -$pscolor<$wdircolor \$(truncpwd)$QUIRK_1_COLOR\$(QUIRK_1) $pscolor>$sepacolor-$fontcolor "
PS1="\n${sepacolor} -${pscolor}( ${usercolor}\u${sepacolor} /${hostcolor} \h${pscolor} )${sepacolor}-${pscolor}( \$(systemkit tty) )${sepacolor}-${pscolor}(${upcolor} uptime: \$(systemkit uptime)${pscolor} )${sepacolor}-${pscolor}(${timecolor} \$(date +%H:%M)${datecolor} \$(date +%d-%b-%y)${pscolor} )${sepacolor}-${pscolor}(${wdircolor} files: \$(systemkit countvisiblefiles)${sepacolor} /${wdircolor} folders: \$(systemkit countvisibledirs)${pscolor} )${sepacolor}-\n -${pscolor}<${wdircolor} \$(truncpwd)${QUIRK_1_COLOR}\$(QUIRK_1) ${pscolor}>${sepacolor}-${fontcolor} "
else
......
......@@ -9,10 +9,10 @@
# #
#########################################################
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n$sepacolor⊏⁅ $usercolor\u$pscolor$hostcolor\h $sepacolor⁆⁅ $datecolor\d $pscolor$timecolor\t$pscolor$upcolor\$(systemkit uptime)$sepacolor ⁆⊐
⊏⁅$wdircolor \$(truncpwd)$SEPA_NG_1_COLOR\$(SEPA_NG_1) $sepacolor⁆⊐≻$fontcolor "
PS1="\n${sepacolor}⊏⁅ ${usercolor}\u${pscolor}${hostcolor}\h ${sepacolor}⁆⁅ ${datecolor}\d ${pscolor}${timecolor}\t${pscolor}${upcolor}\$(systemkit uptime)${sepacolor} ⁆⊐
⊏⁅${wdircolor} \$(truncpwd)${SEPA_NG_1_COLOR}\$(SEPA_NG_1) ${sepacolor}⁆⊐≻${fontcolor} "
else
......
......@@ -10,38 +10,38 @@
#########################################################
sepa=$(ini_get separator)
export pstyle_supported=True
export truncpwd_supported=True
if [[ $enable_colors == "True" ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n$usercolor\u$fontcolor @$hostcolor \h$sepacolor $sepa $datecolor\d$sepacolor $sepa $timecolor\t$sepacolor $sepa $wdircolor\$(truncpwd)"
[[ $(ini_get files_amount) == "True" ]] && PS1+=" files: \$(systemkit countvisiblefiles)"
[[ $(ini_get files_amount) == "True" && $(ini_get file_size) == "True" ]] && PS1+="$sepacolor /"
[[ $(ini_get file_size) == "True" ]] && PS1+="$wdircolor size: \$(systemkit dirsize)"
[[ $(ini_get tty) == "True" ]] && PS1+=" $sepacolor$sepa$hostcolor tty: \$(systemkit tty)"
[[ $(ini_get uptimes) == "True" ]] && PS1+=" $sepacolor$sepa$upcolor uptime: \$(systemkit uptime)"
[[ $(ini_get load) == "True" ]] && PS1+=" $sepacolor$sepa$upcolor system load: \$(systemkit load1)"
[[ $(ini_get processes) == "True" ]] && PS1+=" $sepacolor$sepa$pscolor processes: \$(systemkit processes)"
[[ $(ini_get battery_load) == "True" ]] && PS1+=" $sepacolor$sepa$pscolor battery: \$(systemkit battery)"
[[ $(ini_get mem) == free ]] && PS1+=" $sepacolor$sepa$usercolor free mem: $pscolor\$(systemkit freeram)$usercolor mb"
[[ $(ini_get mem) == used ]] && PS1+=" $sepacolor$sepa$usercolor used mem: $pscolor\$(systemkit usedram)$usercolor mb"
[[ $(ini_get mem) == both ]] && PS1+=" $sepacolor$sepa$usercolor free$sepacolor/${usercolor}used mem: $pscolor\$(systemkit freeram)$sepacolor/$pscolor\$(systemkit usedram)$usercolor mb"
PS1+="$sepacolor $sepa\n$usercolor$SEPA_1_COLOR\$(SEPA_1)\$ $SEPA_2_COLOR\$(SEPA_2)$fontcolor-> "
PS1="\n${usercolor}\u${fontcolor} @${hostcolor} \h${sepacolor} ${sepa} ${datecolor}\d${sepacolor} ${sepa} ${timecolor}\t${sepacolor} ${sepa} ${wdircolor}\$(truncpwd)"
[[ $(ini_get files_amount) == True ]] && PS1+=" files: \$(systemkit countvisiblefiles)"
[[ $(ini_get files_amount) == True && $(ini_get file_size) == True ]] && PS1+="${sepacolor} /"
[[ $(ini_get file_size) == True ]] && PS1+="${wdircolor} size: \$(systemkit dirsize)"
[[ $(ini_get tty) == True ]] && PS1+=" ${sepacolor}${sepa}${hostcolor} tty: \$(systemkit tty)"
[[ $(ini_get uptimes) == True ]] && PS1+=" ${sepacolor}${sepa}${upcolor} uptime: \$(systemkit uptime)"
[[ $(ini_get load) == True ]] && PS1+=" ${sepacolor}${sepa}${upcolor} system load: \$(systemkit load1)"
[[ $(ini_get processes) == True ]] && PS1+=" ${sepacolor}${sepa}${pscolor} processes: \$(systemkit processes)"
[[ $(ini_get battery_load) == True ]] && PS1+=" ${sepacolor}${sepa}${pscolor} battery: \$(systemkit battery)"
[[ $(ini_get mem) == free ]] && PS1+=" ${sepacolor}${sepa}${usercolor} free mem: ${pscolor}\$(systemkit freeram)${usercolor} mb"
[[ $(ini_get mem) == used ]] && PS1+=" ${sepacolor}${sepa}${usercolor} used mem: ${pscolor}\$(systemkit usedram)${usercolor} mb"
[[ $(ini_get mem) == both ]] && PS1+=" ${sepacolor}${sepa}${usercolor} free${sepacolor}/${usercolor}used mem: ${pscolor}\$(systemkit freeram)${sepacolor}/${pscolor}\$(systemkit usedram)${usercolor} mb"
PS1+="${sepacolor} ${sepa}\n${usercolor}$SEPA_1_COLOR\$(SEPA_1)\$ $SEPA_2_COLOR\$(SEPA_2)${fontcolor}-> "
else
PS1="\n\u @ \h $sepa \d $sepa \t $sepa \$(truncpwd)"
[[ $(ini_get files_amount) == "True" ]] && PS1+=" files: \$(systemkit countvisiblefiles)"
[[ $(ini_get files_amount) == "True" && $(ini_get file_size) == "True" ]] && PS1+="$sepacolor /"
[[ $(ini_get file_size) == "True" ]] && PS1+=" size: \$(systemkit dirsize)"
[[ $(ini_get tty) == "True" ]] && PS1+=" $sepa tty: \$(systemkit tty)"
[[ $(ini_get uptimes) == "True" ]] && PS1+=" $sepa uptime: \$(systemkit uptime)"
[[ $(ini_get load) == "True" ]] && PS1+=" $sepa system load: \$(systemkit load1)"
[[ $(ini_get processes) == "True" ]] && PS1+=" $sepa processes: \$(systemkit processes)"
[[ $(ini_get battery_load) == "True" ]] && PS1+=" $sepa battery: \$(systemkit battery)"
[[ $(ini_get mem) == free ]] && PS1+=" $sepa free mem: \$(systemkit freeram) mb"
[[ $(ini_get mem) == used ]] && PS1+=" $sepa used mem: \$(systemkit usedram) mb"
[[ $(ini_get mem) == both ]] && PS1+=" $sepa free/used mem: \$(systemkit freeram)/\$(systemkit usedram) mb"
PS1+=" $sepa\n\$ -> "
PS1="\n\u @ \h ${sepa} \d ${sepa} \t ${sepa} \$(truncpwd)"
[[ $(ini_get files_amount) == True ]] && PS1+=" files: \$(systemkit countvisiblefiles)"
[[ $(ini_get files_amount) == True && $(ini_get file_size) == True ]] && PS1+="${sepacolor} /"
[[ $(ini_get file_size) == True ]] && PS1+=" size: \$(systemkit dirsize)"
[[ $(ini_get tty) == True ]] && PS1+=" ${sepa} tty: \$(systemkit tty)"
[[ $(ini_get uptimes) == True ]] && PS1+=" ${sepa} uptime: \$(systemkit uptime)"
[[ $(ini_get load) == True ]] && PS1+=" ${sepa} system load: \$(systemkit load1)"
[[ $(ini_get processes) == True ]] && PS1+=" ${sepa} processes: \$(systemkit processes)"
[[ $(ini_get battery_load) == True ]] && PS1+=" ${sepa} battery: \$(systemkit battery)"
[[ $(ini_get mem) == free ]] && PS1+=" ${sepa} free mem: \$(systemkit freeram) mb"
[[ $(ini_get mem) == used ]] && PS1+=" ${sepa} used mem: \$(systemkit usedram) mb"
[[ $(ini_get mem) == both ]] && PS1+=" ${sepa} free/used mem: \$(systemkit freeram)/\$(systemkit usedram) mb"
PS1+=" ${sepa}\n\$ -> "
fi
......@@ -9,12 +9,16 @@
# #
#########################################################
export pstyle_supported=True
export truncpwd_supported=True
if [[ $enable_colors == true ]]; then
if [[ ${enable_colors} == True ]]; then
PS1="\n$pscolor$sepacolor♦($usercolor \u$fontcolor @$hostcolor \h $fontcolor: Space on /: $pscolor\$(systemkit usedspace /)$fontcolor used of$pscolor \$(systemkit totalspace /)$sepacolor )♦♦($wdircolor \$(truncpwd)$sepacolor )♦$pscolor\n\
$pscolor$sepacolor♦($timecolor \$(date +%H:%M)$sepacolor$datecolor \$(date \"+%a, %d %b %y\")$sepacolor : uptime :$upcolor \$(systemkit uptime)$sepacolor :$usercolor \$$sepacolor )♦$pscolor$fontcolor "
PS1="\n${pscolor}${sepacolor}♦(${usercolor} \u${fontcolor} @${hostcolor} \h ${fontcolor}: \
Space on /: ${pscolor}\$(systemkit usedspace /)${fontcolor} used of${pscolor} \
\$(systemkit totalspace /)${sepacolor} )♦♦($wdircolor \$(truncpwd)${sepacolor} )♦${pscolor}\n\
${pscolor}${sepacolor}♦(${timecolor} \$(date +%H:%M)${sepacolor}${datecolor} \
\$(date \"+%a, %d %b %y\")${sepacolor} : uptime :${upcolor} \$(systemkit uptime)${sepacolor} \
:${usercolor} \$${sepacolor} )♦${pscolor}${fontcolor} "
else
......