From 300698d02bea736f6922335c3b78964a733787e4 Mon Sep 17 00:00:00 2001 From: ITQ Date: Sat, 5 Jul 2025 20:50:27 +0300 Subject: [PATCH] refactor: improvements in change_profile script --- scripts/change_profile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/change_profile b/scripts/change_profile index 19ce5d9..cf07b2a 100755 --- a/scripts/change_profile +++ b/scripts/change_profile @@ -4,6 +4,13 @@ HOST="server" USER="ubuntu" PASSWORD="ubuntu" +for cmd in sshpass; do + if ! command -v $cmd &> /dev/null; then + echo "Error: $cmd is not installed. Please install it first." + exit 1 + fi +done + echo "Fetching interfaces from server..." interfaces=$(sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o LogLevel=ERROR "$USER@$HOST" \ "ip -o link show | awk -F': ' '!/lo:/ {print \$2}'")