Replace deprecated `hostname` command

This commit is contained in:
Jeremy Gardais 2023-08-30 17:39:46 +02:00
parent a5474bd976
commit c8ec4e2996
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 3 additions and 3 deletions

6
zshrc
View File

@ -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}'
}
# }}}