Fix http() and get_ip()

This commit is contained in:
Sam A. 2022-09-11 19:41:19 +02:00
parent bca632295f
commit 829b6a2310
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -42,14 +42,15 @@ get_ip() {
shift
done
eval "curl ${ARGS[@]} -fsSL 'https://ifconfig.co/json$IP' \
$( (( ${+commands[jq]} )) && echo "| jq" )"
(( ${+commands[jq]} )) && local JQ="| jq"
eval "curl ${ARGS[@]} -fsSL 'https://ifconfig.co/json$IP' $JQ"
}
http() {
(( ${+commands[python]} )) || return 2
eval "python -m http.server 8080 --bind 127.0.0.1 \
$( [[ $# -gt 0 ]] && echo "--directory $1" ) $@"
[[ $# -gt 0 ]] && local DIR="--directory=$1" && shift
eval "python -m http.server 8080 --bind 127.0.0.1 $DIR $@"
}
open() {