Обновить galias-d.sh

This commit is contained in:
2026-02-20 21:13:22 +05:00
parent 8e9b0d542e
commit 858ec5b785

View File

@@ -1,6 +1,6 @@
#!/bin/bash
set -x
# set -x
# Цвета для вывода
RED='\033[0;31m'
@@ -10,11 +10,11 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Форматирование текста
function msgerr()
function msgerr() # Вывод сообщения с ошибкой
{
echo -e "${RED}$1${NC}"
}
function msgok()
function msgok() # Сообщение с успешным выполнением
{
echo -e "${GREEN}$1${NC}"
}
@@ -25,10 +25,23 @@ function msgpr()
msgpr "hey! this is talias-d!"
msgerr "hey! this is ERROR!"
msgok "hey! this is OK!"
check_apt() {
sudo apt install $1 -y
}
## ИИ
find_public_keys() {
local keys=()
if [[ -d "$SSH_DIR" ]]; then
# Ищем все .pub файлы в директории .ssh
while IFS= read -r -d '' key_file; do
keys+=("$key_file")
done < <(find "$SSH_DIR" -maxdepth 1 -name "*.pub" -type f -print0 2>/dev/null)
fi
printf '%s\n' "${keys[@]}"
}