Fix get_ip()

This commit is contained in:
Sam A. 2022-09-27 18:39:37 +02:00
parent 3cf5d8837f
commit 298b66ce6f
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -33,9 +33,10 @@ doasedit() {
get_ip() { get_ip() {
(( ${+commands[curl]} )) || return 2 (( ${+commands[curl]} )) || return 2
local ARGS=()
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
[[ $1 == --ip ]] && local IP="?ip=$2" && shift || local ARGS+=("$1") [[ $1 == --ip ]] && local IP="?ip=$2" && shift || ARGS+=("$1")
shift shift
done done
@ -45,7 +46,6 @@ get_ip() {
http() { http() {
(( ${+commands[python]} )) || return 2 (( ${+commands[python]} )) || return 2
[[ $# -gt 0 ]] && local DIR="--directory=$1" && shift [[ $# -gt 0 ]] && local DIR="--directory=$1" && shift
eval "python -m http.server 8080 --bind 127.0.0.1 $DIR $@" eval "python -m http.server 8080 --bind 127.0.0.1 $DIR $@"
} }