Fix fip function on zsh
This commit is contained in:
committed by
David Heinemeier Hansson
parent
d4d1b518e0
commit
26bca7d834
@@ -1,17 +1,17 @@
|
||||
# SSH Port Forwarding Functions
|
||||
fip() {
|
||||
(( $# < 2 )) && echo "Usage: fip <host> <port1> [port2] ..." && return 1
|
||||
local host="$1"
|
||||
local host="${1}"
|
||||
shift
|
||||
for port in "$@"; do
|
||||
ssh -f -N -L "$port:localhost:$port" "$host" && echo "Forwarding localhost:$port -> $host:$port"
|
||||
ssh -f -N -L "${port}:localhost:${port}" "${host}" && echo "Forwarding localhost:${port} -> ${host}:${port}"
|
||||
done
|
||||
}
|
||||
|
||||
dip() {
|
||||
(( $# == 0 )) && echo "Usage: dip <port1> [port2] ..." && return 1
|
||||
for port in "$@"; do
|
||||
pkill -f "ssh.*-L $port:localhost:$port" && echo "Stopped forwarding port $port" || echo "No forwarding on port $port"
|
||||
pkill -f "ssh.*-L ${port}:localhost:${port}" && echo "Stopped forwarding port ${port}" || echo "No forwarding on port ${port}"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user