From 29e4922e6ea2f7799fb4040297c025fce8790555 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Sat, 25 Sep 2021 13:14:32 +0100 Subject: [PATCH] Refactor ssh port forwarding --- quickemu | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/quickemu b/quickemu index 3e327c6..efba8ce 100755 --- a/quickemu +++ b/quickemu @@ -388,11 +388,11 @@ function vm_boot() { local NET="user,hostname=${VMNAME}" # Find a free port to expose ssh to the guest - local PORT="" - PORT=$(get_port 22220 9) - if [ -n "${PORT}" ]; then - NET="${NET},hostfwd=tcp::${PORT}-:22" - echo " - ssh: ${PORT}/tcp is connected. Login via 'ssh user@localhost -p ${PORT}'" + local SSH_PORT="" + SSH_PORT=$(get_port 22220 9) + if [ -n "${SSH_PORT}" ]; then + NET="${NET},hostfwd=tcp::${SSH_PORT}-:22" + echo " - ssh: ${SSH_PORT}/tcp is connected. Login via 'ssh user@localhost -p ${SSH_PORT}'" else echo " - ssh: All ports for exposing ssh have been exhausted." fi