Answer the question
In order to leave comments, you need to log in
How to substitute the value of a variable from a file in bash?
I want to automate a small task
Here is a sketch of a bash script, it works "by the piece" - each time I enter the IP
#!/bin/bash
echo "Enter IP"
read ip_addr
echo
echo
echo Посылаем обратный dns-запрос
dns_query_1=$(nslookup $ip_addr | grep -oP "name = \K[^ ]+\.*")
dns_query_2=$(echo ${dns_query_1::-1})
echo
echo $dns_query_2
curl --silent http://counter.yadro.ru/values?site=$dns_query_2 | grep 'LI_day_vis'
echo "Ок"
curl --silent http://counter.yadro.ru/values?site=habr.ru | grep 'LI_day_vis'
LI_day_vis = 422;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question