3 Commits

Author SHA1 Message Date
fatalerrors
ac66e896dd exit -> return 2026-04-01 15:56:48 +02:00
fatalerrors
0712be626b wording and other minor improvments 2026-04-01 15:53:44 +02:00
fatalerrors
3f8b81562b sorted alias out 2026-04-01 15:53:10 +02:00
3 changed files with 49 additions and 22 deletions

View File

@@ -70,26 +70,41 @@ MAKEFLAGS='-j12'
PKGSOURCES='/share/src/archives' PKGSOURCES='/share/src/archives'
[aliases] [aliases]
# Aliases section is used to set user aliases, it is loaded only for
# interactive shells.
# Various ls aliases
ll='ls -laFh --color=auto' ll='ls -laFh --color=auto'
la='ls -Ah --color=auto' la='ls -Ah --color=auto'
l='ls -CF --color=auto' l='ls -CF --color=auto'
ls='ls --color=auto' ls='ls --color=auto'
# Add color to grep output
grep='grep --color=auto' grep='grep --color=auto'
egrep='egrep --color=auto' egrep='egrep --color=auto'
fgrep='fgrep --color=auto' fgrep='fgrep --color=auto'
# Quick find alias
qfind="find . -name " qfind="find . -name "
# Some alias for compiling
mk='make'
mkck='make check' mkck='make check'
mkin='make install' mkin='make install'
mkdin='make DESTDIR=$PWD/dest-install install' mkdin='make DESTDIR=$PWD/dest-install install'
# ssh alias with X11 forwarding, without right restriction
ssh='ssh -Y' ssh='ssh -Y'
# Resume mode for wget
wget='wget -c' # resume mode by default wget='wget -c' # resume mode by default
myip='curl ip.appspot.com'
# Human readable by default # Human readable by default
df='df -H' df='df -H'
du='du -ch' du='du -ch'
sdu='du -sk ./* | sort -n' sdu='du -sk ./* | sort -n'
hdu='du -hs ./* | sort -H' hdu='du -hs ./* | sort -H'
# Readable dmesg timestamps
dmesg='dmesg -T'
# End of profile.conf

View File

@@ -299,7 +299,7 @@ rmspc()
( (
local lastdir=$f local lastdir=$f
(( verb )) && disp I "Entering directory $(pwd)/$f ..." (( verb )) && disp I "Entering directory $(pwd)/$f ..."
pushd "$f" >/dev/null || exit 1 pushd "$f" >/dev/null || return 1
if (( substchar_set )); then if (( substchar_set )); then
rmspc ${recurs:+-r} -c "$substchar" ${verb:+-v} ${shell:+-s} rmspc ${recurs:+-r} -c "$substchar" ${verb:+-v} ${shell:+-s}
@@ -307,7 +307,7 @@ rmspc()
rmspc ${recurs:+-r} ${verb:+-v} ${shell:+-s} rmspc ${recurs:+-r} ${verb:+-v} ${shell:+-s}
fi fi
popd >/dev/null || exit 1 popd >/dev/null || return 1
(( verb )) && disp I "Leaving directory $(pwd)/$lastdir" (( verb )) && disp I "Leaving directory $(pwd)/$lastdir"
) )
fi fi

View File

@@ -39,11 +39,14 @@
# Usage: ver # Usage: ver
ver() ver()
{ {
local PARSED=$(getopt -o h --long help -n 'ver' -- "$@") local PARSED
PARSED=$(getopt -o h --long help -n 'ver' -- "$@")
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
disp E "Invalid options, use \"ver --help\" to display usage." disp E "Invalid options, use \"ver --help\" to display usage."
return 1 return 1
fi fi
eval set -- "$PARSED" eval set -- "$PARSED"
while true; do while true; do
case "$1" in case "$1" in
@@ -72,11 +75,13 @@ export -f ver
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Display weather of the given city (or default one) # Display weather for the given city (or the default one)
# Usage: meteo [city1 city2 ...] # Usage: meteo [city1 city2 ...]
meteo() meteo()
{ {
local PARSED=$(getopt -o h --long help -n 'meteo' -- "$@") local PARSED
PARSED=$(getopt -o h --long help -n 'meteo' -- "$@")
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
disp E "Invalid options, use \"meteo --help\" to display usage." disp E "Invalid options, use \"meteo --help\" to display usage."
return 1 return 1
@@ -85,7 +90,9 @@ meteo()
while true; do while true; do
case "$1" in case "$1" in
-h|--help) -h|--help)
printf "meteo: Fetch weather data.\nUsage: meteo [city1 city2 ...]\n" printf "meteo: Fetch weather data.\n"
printf "Usage: meteo [city1 city2 ...]\n"
printf "If no city is provided, the default city from configuration will be used.\n"
return 0 return 0
;; ;;
--) --)
@@ -100,12 +107,13 @@ meteo()
done done
local cities=("$@") local cities=("$@")
local city="" encoded=""
[[ $# -eq 0 ]] && cities=("$DEFAULT_CITY") [[ $# -eq 0 ]] && cities=("$DEFAULT_CITY")
for city in "${cities[@]}"; do for city in "${cities[@]}"; do
encoded=$(urlencode "$city") encoded=$(urlencode "$city")
dwl "https://wttr.in/$encoded" || \ dwl "https://wttr.in/$encoded" || \
disp E "Failed fetching datas for $city." disp E "Failed to fetch weather data for $city."
done done
} }
export -f meteo export -f meteo
@@ -117,16 +125,20 @@ export -f meteo
# Usage: showinfo # Usage: showinfo
showinfo() showinfo()
{ {
local PARSED=$(getopt -o h --long help -n 'showinfo' -- "$@") local PARSED
PARSED=$(getopt -o h --long help -n 'showinfo' -- "$@")
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
disp E "Invalid options, use \"showinfo --help\" to display usage." disp E "Invalid options, use \"showinfo --help\" to display usage."
return 1 return 1
fi fi
eval set -- "$PARSED" eval set -- "$PARSED"
while true; do while true; do
case "$1" in case "$1" in
-h|--help) -h|--help)
printf "showinfo: Display system information (hostname, kernel, uptime).\nUsage: showinfo\n" printf "showinfo: Display system information (hostname, kernel, uptime and fetch output when available).\n"
printf "Usage: showinfo\n"
return 0 return 0
;; ;;
--) --)
@@ -140,20 +152,20 @@ showinfo()
esac esac
done done
local hostname_str
local figopt=()
hostname_str="$(hostname)"
printf "\n" printf "\n"
if command -v figlet >/dev/null 2>&1; then if command -v figlet >/dev/null 2>&1; then
if [[ -s /usr/share/figlet/ansi_shadow.flf ]]; then [[ -s /usr/share/figlet/ansi_shadow.flf ]] && \
local figopt="-f ansi_shadow" figopt=(-f ansi_shadow)
fi figlet -k "${figopt[@]}" "$hostname_str"
if [[ -n $figopt ]]; then
figlet -k $figopt $(hostname)
else else
figlet $(hostname) printf "%s\n" "$hostname_str"
fi fi
else
hostname -f printf "\n"
fi
echo ""
if command -v neofetch >/dev/null 2>&1; then if command -v neofetch >/dev/null 2>&1; then
neofetch neofetch
elif command -v fastfetch >/dev/null 2>&1; then elif command -v fastfetch >/dev/null 2>&1; then
@@ -163,11 +175,11 @@ showinfo()
if [[ -s /etc/os-release ]]; then if [[ -s /etc/os-release ]]; then
# shellcheck disable=SC1091 # shellcheck disable=SC1091
. /etc/os-release . /etc/os-release
printf "$NAME $VERSION\n" printf "%s %s\n" "$NAME" "$VERSION"
else else
cat /proc/version cat /proc/version
fi fi
printf "Uptime: $(uptime -p)\n" printf "Uptime: %s\n" "$(uptime -p)"
) )
fi fi
} }