improved profile to 2.6.3
This commit is contained in:
@@ -17,15 +17,18 @@
|
||||
# 16/01/2020 Version 2.3.1 : [bugfix] non-interactive were blocked with some functions
|
||||
# 31/01/2020 Version 2.3.2 : Figlet: changed default font to ansi_shadow
|
||||
# 02/03/2020 Version 2.4.0 : Added command auzip
|
||||
# 03/03/2020 Version 2.5.0 : Added command taz and rmspc, auzip->utaz improved
|
||||
# 03/03/2020 Version 2.5.0 : Added command taz and rmspc, auzip => utaz improved
|
||||
# 05/03/2020 Version 2.5.1 : Language consistancy fix, added pigz support in taz
|
||||
# 06/03/2020 Version 2.5.2 : Few aliases sorted out
|
||||
# 11/09/2020 Version 2.5.3 : Few more aliases, improved code consistancy and typo,
|
||||
# : improved utaz, removed showdiskmap, removed remaining French,
|
||||
# : improved utaz, removed showdiskmap
|
||||
# : removed remaining French,
|
||||
# : added license information for future publication
|
||||
# 24/10/2020 Version 2.6.0 : Added session save and restore for Konsole
|
||||
# 25/12/2020 Version 2.6.1 : Add check on rmhost, improvements rmspc, created expendlist
|
||||
# 26/02/2021 Version 2.6.2 : taz: corrected bug with trailing slash on directories
|
||||
# 18/10/2021 Version 2.6.3 : changed PS1 for status bar style version
|
||||
# few minor improvements
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2013-2020 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
||||
# Protected by the BSD3 license. Please read bellow for details.
|
||||
@@ -61,7 +64,7 @@
|
||||
# * OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export PROFVERSION="2.6.2"
|
||||
export PROFVERSION="2.6.3"
|
||||
|
||||
export DEFAULT_CITY="Toulouse"
|
||||
|
||||
@@ -170,7 +173,7 @@ set_prompt ()
|
||||
Checkmark='\342\234\223'
|
||||
|
||||
# Begin with time
|
||||
PS1="$Blue$OnGrey[ \t ]$Default "
|
||||
PS1="\[\e[s\e[1;1H$Blue$OnGrey [ \t ] $OnBlue"
|
||||
|
||||
# Add a bright white exit status for the last command
|
||||
|
||||
@@ -186,7 +189,7 @@ set_prompt ()
|
||||
|
||||
# Add the ellapsed time and current date
|
||||
timer_stop
|
||||
PS1+="($timer_show)$White ]$Default "
|
||||
PS1+="($timer_show)$White ] $OnBlue "
|
||||
|
||||
# If root, just print the host in red. Otherwise, print the current user
|
||||
# and host in green.
|
||||
@@ -195,6 +198,7 @@ set_prompt ()
|
||||
else
|
||||
PS1+="$Green\\u@\\h"
|
||||
fi
|
||||
PS1+="\e[K\e[u$Default"
|
||||
# Print the working directory and prompt marker in blue, and reset
|
||||
# the text color to the default.
|
||||
PS1+="$ICyan\\w \\\$$Default "
|
||||
@@ -208,7 +212,6 @@ ver ()
|
||||
echo "Profile version $PROFVERSION."
|
||||
}
|
||||
export ver
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Change locale to French
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -342,17 +345,18 @@ ssr ()
|
||||
done
|
||||
|
||||
[[ ! $1 ]] &&
|
||||
echo "Please specify the server you want to log in." && return 1
|
||||
echo "Please specify the server you want to log in." &&
|
||||
return 1
|
||||
|
||||
local srv=$1 && shift
|
||||
|
||||
ssh -y root@$srv $@
|
||||
ssh -Y root@$srv $@
|
||||
}
|
||||
export ssr
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Look for a package within installed one
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
dpkgs ()
|
||||
{
|
||||
local count=0
|
||||
@@ -375,31 +379,36 @@ dpkgs ()
|
||||
local pkg=$1 && shift
|
||||
count=$(( $count + 1 ))
|
||||
[[ $count -gt 1 ]] &&
|
||||
echo "*** Error: Please specify a package name, without space, eventually partial." && return 1
|
||||
echo "*** Error: Please specify a package name, without space, eventually partial." &&
|
||||
return 1
|
||||
|
||||
;;
|
||||
esac
|
||||
done
|
||||
[[ $count -lt 1 ]] && echo "*** Error: Please specify a package name, without space, eventually partial." && return 1
|
||||
[[ $count -lt 1 ]] &&
|
||||
echo "*** Error: Please specify a package name, without space, eventually partial." &&
|
||||
return 1
|
||||
|
||||
[[ -x /usr/sbin/dpkg ]] && "*** Error: dpkg command seems unavialable." && return 2
|
||||
[[ -x /usr/sbin/dpkg ]] &&
|
||||
echo "*** Error: dpkg command seems unavialable." &&
|
||||
return 2
|
||||
|
||||
dpkg -l | grep $pkg
|
||||
}
|
||||
export dpkgs
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Search processes matching the given string
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
ppg ()
|
||||
{
|
||||
ps -edf | grep $@ | grep -v "grep $@"
|
||||
}
|
||||
export ppg
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Create a directory then goes inside
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
mcd () {
|
||||
if [[ ! $# -eq 1 ]] ; then
|
||||
echo "Create a directory then goes inside."
|
||||
@@ -410,9 +419,9 @@ mcd () {
|
||||
}
|
||||
export mcd
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Get PID list of the given process name
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
gpid () {
|
||||
[[ $# -eq 1 ]] && local single=1
|
||||
for pid in $@; do
|
||||
@@ -427,9 +436,9 @@ gpid () {
|
||||
}
|
||||
export gpid
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Remove host from know_host (name and IP) for the active user
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
rmhost () {
|
||||
if [[ "$#" -ne 1 ]]; then
|
||||
echo "Error: incorrect number of parameters."
|
||||
@@ -448,9 +457,9 @@ rmhost () {
|
||||
}
|
||||
export rmhost
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Rename all files in current directory to replace spaces with _
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
rmspc () {
|
||||
local lst=""
|
||||
for opt in $@ ; do
|
||||
@@ -520,9 +529,9 @@ rmspc () {
|
||||
}
|
||||
export rmspc
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Smartly uncompress archives (zip only)
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
utaz()
|
||||
{
|
||||
for opt in $@ ; do
|
||||
@@ -621,9 +630,9 @@ utaz()
|
||||
}
|
||||
export utaz
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Compress directories or files into one or more archive
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
taz()
|
||||
{
|
||||
_doxz()
|
||||
@@ -841,12 +850,13 @@ taz()
|
||||
|
||||
echo "--- Done"
|
||||
done
|
||||
|
||||
}
|
||||
export taz
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Display system genal information
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
showinfo() {
|
||||
echo ""
|
||||
figlet $(hostname) -t -k
|
||||
@@ -855,9 +865,9 @@ showinfo() {
|
||||
}
|
||||
export showinfo
|
||||
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# Save or restore Konsle session manually
|
||||
# ------------------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
ksession() {
|
||||
# Configuration
|
||||
local command=''
|
||||
@@ -866,12 +876,10 @@ ksession() {
|
||||
|
||||
# Restore if asked to
|
||||
if [[ "$1" = "restore" ]]; then
|
||||
|
||||
echo "Restoring..."
|
||||
konsole --tabs-from-file $savefile -e 'bash -c exit' &
|
||||
|
||||
elif [[ "$1" = "save" ]]; then
|
||||
|
||||
pid=$(pgrep konsole -u $USER)
|
||||
if [[ $pid ]]; then
|
||||
echo "# Most recent session list " $(date) > $savefile
|
||||
@@ -925,11 +933,12 @@ export ksession
|
||||
if [[ $EUID -eq 0 ]] ; then
|
||||
pathappend /sbin:/usr/sbin
|
||||
fi
|
||||
[[ -d ~/.gem/ruby/2.3.0/bin ]] && pathappend ~/.gem/ruby/2.3.0/bin
|
||||
[[ -d /share/services/gestparc ]] && pathappend /share/services/gestparc
|
||||
[[ -d ~/bin ]] && pathappend ~/bin
|
||||
[[ -d ~/.local/bin ]] && pathappend ~/.local/bin
|
||||
|
||||
# Set bash history
|
||||
export HISTSIZE=10000
|
||||
export HISTSIZE=50000
|
||||
export HISTIGNORE="&:[bf]g:exit"
|
||||
|
||||
# Set default pager
|
||||
@@ -966,7 +975,7 @@ if [[ $INTERACTIVE ]]; then
|
||||
alias mkck='make check'
|
||||
alias mkin='make install'
|
||||
alias mkdin='make DESTDIR=$PWD/dest-install install'
|
||||
alias ssh='ssh -x'
|
||||
alias ssh='ssh -Y'
|
||||
|
||||
alias wget='wget -c' # resume mode by default
|
||||
alias myip='curl ip.appspot.com'
|
||||
|
||||
Reference in New Issue
Block a user