v3.0.1: many small improvement and bugfix
This commit is contained in:
@@ -255,7 +255,7 @@ taz ()
|
||||
;;
|
||||
|
||||
"-"[1..9])
|
||||
local complevel=${opt:1:1}
|
||||
local complevel=$(echo $opt | sed 's/-//')
|
||||
;;
|
||||
|
||||
"-"*)
|
||||
|
||||
@@ -25,7 +25,7 @@ function error ()
|
||||
{
|
||||
local errcode=$?
|
||||
backtrace
|
||||
exit $errcode
|
||||
return $errcode
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ settrace ()
|
||||
{
|
||||
local status="off"
|
||||
[[ $(trap -p ERR) ]] && status="on"
|
||||
trap -p ERR
|
||||
#trap -p ERR
|
||||
for opt in $@ ; do
|
||||
case $opt in
|
||||
"-h"|"--help")
|
||||
|
||||
@@ -114,8 +114,11 @@ rmspc ()
|
||||
echo " -c, --subst-char Change the replacement character (default is underscore)"
|
||||
echo " -v, --verbose Display what is being done"
|
||||
echo " -s, --shell Do nothing and display commands that would be executed"
|
||||
echo
|
||||
return 0
|
||||
echo
|
||||
echo "Note: if the --subst-char option is given without parameters, spaces will be"
|
||||
echo " replaced with nothing (concatenation)."
|
||||
echo
|
||||
return 0
|
||||
;;
|
||||
|
||||
"-r"|"--recursive")
|
||||
@@ -123,11 +126,15 @@ rmspc ()
|
||||
;;
|
||||
|
||||
"-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")
|
||||
local verb=1
|
||||
"-v"|"--verbose")
|
||||
local verb=1
|
||||
;;
|
||||
|
||||
"-s"|"--shell")
|
||||
@@ -143,6 +150,7 @@ rmspc ()
|
||||
done
|
||||
|
||||
[[ ! $substchar ]] && substchar="_"
|
||||
[[ $substchar == "none" ]] && local substchar=""
|
||||
[[ $verb ]] && local mvopt="-v"
|
||||
|
||||
for f in *; do
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Display list of commands and general informations
|
||||
# ------------------------------------------------------------------------------
|
||||
help ()
|
||||
help()
|
||||
{
|
||||
cat <<EOF
|
||||
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
|
||||
isipv4 Tell if the given IPv4 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
|
||||
meteo Display curent weather forecast for the configured city
|
||||
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
|
||||
ver Display version of your copy of profile
|
||||
|
||||
Please use <command> --help to obtain usage details.
|
||||
EOF
|
||||
}
|
||||
export -f help
|
||||
|
||||
@@ -17,7 +17,7 @@ meteo ()
|
||||
[[ $# -eq 0 ]] && local cities=$DEFAULT_CITY
|
||||
|
||||
for city in $cities; do
|
||||
curl https://wttr.in/$city
|
||||
curl https://wttr.in/$city || echo "Failed fetching datas for $city."
|
||||
done
|
||||
}
|
||||
export -f meteo
|
||||
@@ -30,7 +30,10 @@ showinfo()
|
||||
{
|
||||
echo -e "\n"
|
||||
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
|
||||
echo "$(hostname -f)"
|
||||
fi
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
# 19/07/2022 v2.8.1 : few cleanup, fixes and optimizations
|
||||
# 29/07/2022 v2.8.2 : added warning for non bash users
|
||||
# 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>
|
||||
# Protected by the BSD3 license. Please read bellow for details.
|
||||
@@ -68,7 +69,7 @@
|
||||
# * OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export PROFVERSION="3.0.0"
|
||||
export PROFVERSION="3.0.1"
|
||||
|
||||
export DEFAULT_CITY="Toulouse"
|
||||
|
||||
@@ -200,4 +201,5 @@ fi
|
||||
unset pathremove pathprepend pathappend
|
||||
|
||||
#return 0
|
||||
# End /etc/profile
|
||||
|
||||
# End profile.sh
|
||||
|
||||
Reference in New Issue
Block a user