1
0
Fork 0
mirror of https://gitlab.com/mlunax/dotfiles.git synced 2025-04-12 05:40:17 +00:00
dotfiles/bin/hosts.sh
2023-11-07 08:44:41 +01:00

13 lines
250 B
Bash
Executable file

#!/bin/bash
#bash hosts.sh domain.pl serwer.lh.pl
if [ $# -eq 2 ]; then
DOMAIN=$1
SERWER=$2
else
echo "DOMAIN:"
read DOMAIN
echo "SERWER:"
read SERWER
fi
IP=`dig +short A $SERWER | tr -d '\n'`
echo "$IP $DOMAIN www.$DOMAIN" | tee -a /etc/hosts