2
0
Fork 0

sh.zio.notify: fix regex incorrect matching

main
Ducky 2024-04-02 01:18:00 +01:00
parent bfdd064e34
commit 5b446422c0
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ function get_host_emoji() {
hostname="$1"
hostname_length="${#hostname}"
if [[ "$hostname" =~ ([a-z]{2}[0-9]{2,3}) ]]; then
if [[ "$hostname" =~ (^| )([a-z]{2}[0-9]{2,3})($| ) ]]; then
case "${hostname:0:2}" in
"de") echo "🇩🇪" ;;
"fi") echo "🇫🇮" ;;
@ -23,7 +23,7 @@ function get_host_emoji() {
"nl") echo "🇳🇱" ;;
*) echo "❔" ;;
esac
elif [[ "$hostname" =~ ([a-z]{3}[0-9]{3}) ]]; then
elif [[ "$hostname" =~ (^| )([a-z]{3}[0-9]{3})($| ) ]]; then
echo "☁️"
else
echo "🖥️"