Only brace the expansions zsh misparses

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-19 17:48:17 -07:00
co-authored by Claude Fable 5
parent 26bca7d834
commit ddab62ea0d
+3 -3
View File
@@ -1,17 +1,17 @@
# SSH Port Forwarding Functions # SSH Port Forwarding Functions
fip() { fip() {
(( $# < 2 )) && echo "Usage: fip <host> <port1> [port2] ..." && return 1 (( $# < 2 )) && echo "Usage: fip <host> <port1> [port2] ..." && return 1
local host="${1}" local host="$1"
shift shift
for port in "$@"; do 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 done
} }
dip() { dip() {
(( $# == 0 )) && echo "Usage: dip <port1> [port2] ..." && return 1 (( $# == 0 )) && echo "Usage: dip <port1> [port2] ..." && return 1
for port in "$@"; do 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 done
} }