From c8ec4e2996fbbc85f3209d5a40e9dc364e5d0e39 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 30 Aug 2023 17:39:46 +0200 Subject: [PATCH] Replace deprecated `hostname` command --- zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zshrc b/zshrc index fd5f9c6..d2ed76b 100644 --- a/zshrc +++ b/zshrc @@ -336,9 +336,9 @@ alias rd='rmdir' #Internet ## Minimal webserver from current directory and available at http://IP.AD.RE.SS:8002 ## See : https://docs.python.org/3/library/http.server.html -alias httpserv='python3 -m http.server -b $(hostname -i) 8002' +alias httpserv="python3 -m http.server -b $(ip route get 1 | awk '{print $(NF-2);exit}') 8002" ## Minimal webserver with upload option and storage in dedicated directory -alias httpup="mkdir --parent -- /tmp/http.upload.directory && cd -- /tmp/http.upload.directory && python3 ${HOME}/bin/upload-http-server.py --listen $(hostname -i) --port 8004" +alias httpup="mkdir --parent -- /tmp/http.upload.directory && cd -- /tmp/http.upload.directory && python3 ${HOME}/bin/upload-http-server.py --listen $(ip route get 1 | awk '{print $(NF-2);exit}') --port 8004" ## Limite l'envoi à 3 requêtes pour ping alias ping="ping -c 3" @@ -1317,7 +1317,7 @@ function ippriv() # Get main private IP adress {{{ function ipmain() { - hostname -i + ip route get 1 | awk '{print $(NF-2);exit}' } # }}}