1
0
Fork 0
forked from ahurac/dotfiles
ahuarc-dotfiles/bin/vncsconnect

38 lines
588 B
Text
Raw Normal View History

2023-04-13 00:04:20 +02:00
#!/bin/bash
# Variables
declare -a make_ssh_bridge open_vnc_session
ssh_fwd=ssh-fwd
2023-04-15 23:00:45 +02:00
vncviewer=wlvncc
2023-04-13 00:04:20 +02:00
localhost=localhost
# Arguments
ssh_host="$1" ; shift
local_port="${1:-9900}" ; shift
distant_port="${1:-5900}"; shift
target="$1" ; shift
2023-04-13 00:04:20 +02:00
# Commands building
# Make SSH bridge
make_ssh_bridge+=(
"$ssh_fwd"
"$ssh_host"
"$local_port"
"$distant_port"
"$target"
)
# Open VNC session
open_vnc_session+=(
"$vncviewer"
"$@"
"${localhost}"
"${local_port}"
2023-04-13 00:04:20 +02:00
)
# Execution
set -xe
"${make_ssh_bridge[@]}"
"${open_vnc_session[@]}"