v3.0.1: many small improvement and bugfix

This commit is contained in:
2022-11-08 16:04:14 +01:00
parent 011e657e49
commit d3c98dd736
6 changed files with 29 additions and 14 deletions

View File

@@ -255,7 +255,7 @@ taz ()
;; ;;
"-"[1..9]) "-"[1..9])
local complevel=${opt:1:1} local complevel=$(echo $opt | sed 's/-//')
;; ;;
"-"*) "-"*)

View File

@@ -25,7 +25,7 @@ function error ()
{ {
local errcode=$? local errcode=$?
backtrace backtrace
exit $errcode return $errcode
} }
@@ -36,7 +36,7 @@ settrace ()
{ {
local status="off" local status="off"
[[ $(trap -p ERR) ]] && status="on" [[ $(trap -p ERR) ]] && status="on"
trap -p ERR #trap -p ERR
for opt in $@ ; do for opt in $@ ; do
case $opt in case $opt in
"-h"|"--help") "-h"|"--help")

View File

@@ -114,8 +114,11 @@ rmspc ()
echo " -c, --subst-char Change the replacement character (default is underscore)" echo " -c, --subst-char Change the replacement character (default is underscore)"
echo " -v, --verbose Display what is being done" echo " -v, --verbose Display what is being done"
echo " -s, --shell Do nothing and display commands that would be executed" echo " -s, --shell Do nothing and display commands that would be executed"
echo echo
return 0 echo "Note: if the --subst-char option is given without parameters, spaces will be"
echo " replaced with nothing (concatenation)."
echo
return 0
;; ;;
"-r"|"--recursive") "-r"|"--recursive")
@@ -123,11 +126,15 @@ rmspc ()
;; ;;
"-c"?*|"--subst-char"?*) "-c"?*|"--subst-char"?*)
local substchar=$(echo "$opt" | cut -f 2- -d '=') if [[ $(echo $opt | grep "=") ]]; then
;; local substchar=$(echo "$opt" | cut -f 2- -d '=')
else
local substchar='none'
fi
;;
"-v"|"--verbose") "-v"|"--verbose")
local verb=1 local verb=1
;; ;;
"-s"|"--shell") "-s"|"--shell")
@@ -143,6 +150,7 @@ rmspc ()
done done
[[ ! $substchar ]] && substchar="_" [[ ! $substchar ]] && substchar="_"
[[ $substchar == "none" ]] && local substchar=""
[[ $verb ]] && local mvopt="-v" [[ $verb ]] && local mvopt="-v"
for f in *; do for f in *; do

View File

@@ -1,7 +1,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Display list of commands and general informations # Display list of commands and general informations
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
help () help()
{ {
cat <<EOF cat <<EOF
clean Erase backup files clean Erase backup files
@@ -9,6 +9,7 @@ dpkgs Search for the given package in the installed ones
gpid Give the list of PIDs for the given process name gpid Give the list of PIDs for the given process name
isipv4 Tell if the given IPv4 is valid isipv4 Tell if the given IPv4 is valid
isipv6 Tell if the given IPv6 is valid isipv6 Tell if the given IPv6 is valid
ku Kill process owned by users in parameter
mcd Create a directory and go inside mcd Create a directory and go inside
meteo Display curent weather forecast for the configured city meteo Display curent weather forecast for the configured city
ppg Display process matching the given parameter ppg Display process matching the given parameter
@@ -25,6 +26,7 @@ taz Compress smartly the given files or directory
utaz Uncompress all zip files in the given (or current) directory utaz Uncompress all zip files in the given (or current) directory
ver Display version of your copy of profile ver Display version of your copy of profile
Please use <command> --help to obtain usage details.
EOF EOF
} }
export -f help export -f help

View File

@@ -17,7 +17,7 @@ meteo ()
[[ $# -eq 0 ]] && local cities=$DEFAULT_CITY [[ $# -eq 0 ]] && local cities=$DEFAULT_CITY
for city in $cities; do for city in $cities; do
curl https://wttr.in/$city curl https://wttr.in/$city || echo "Failed fetching datas for $city."
done done
} }
export -f meteo export -f meteo
@@ -30,7 +30,10 @@ showinfo()
{ {
echo -e "\n" echo -e "\n"
if command -v figlet >/dev/null 2>&1; then if command -v figlet >/dev/null 2>&1; then
figlet -k $(hostname) if [[ -s /usr/share/figlet/ansi_shadow.flf ]]; then
local figopt="-f ansi_shadow"
fi
figlet -k $(hostname) $figopt
else else
echo "$(hostname -f)" echo "$(hostname -f)"
fi fi

View File

@@ -33,6 +33,7 @@
# 19/07/2022 v2.8.1 : few cleanup, fixes and optimizations # 19/07/2022 v2.8.1 : few cleanup, fixes and optimizations
# 29/07/2022 v2.8.2 : added warning for non bash users # 29/07/2022 v2.8.2 : added warning for non bash users
# 27/08/2022 v3.0.0 : splitted everything, added rain screensaver # 27/08/2022 v3.0.0 : splitted everything, added rain screensaver
# 07/11/2022 v3.0.1 : added concatenation to rmspc, added ku, error managed in meteo
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Copyright (c) 2013-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org> # Copyright (c) 2013-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# Protected by the BSD3 license. Please read bellow for details. # Protected by the BSD3 license. Please read bellow for details.
@@ -68,7 +69,7 @@
# * OF SUCH DAMAGE. # * OF SUCH DAMAGE.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
export PROFVERSION="3.0.0" export PROFVERSION="3.0.1"
export DEFAULT_CITY="Toulouse" export DEFAULT_CITY="Toulouse"
@@ -200,4 +201,5 @@ fi
unset pathremove pathprepend pathappend unset pathremove pathprepend pathappend
#return 0 #return 0
# End /etc/profile
# End profile.sh