私は bash スクリプトにかなり慣れていませんが、できる限り多くのことを学ぼうとしています。スクリプトを作成しましたが、いくつかの問題があります。1. ユーザーが「y」と答えてスクリプトを再度実行した場合、スクリプトを引き続き実行したい。2. また、スクリプトでファイルを出力するが、ファイル名を 1 増やしたいと考えています。これは私が使用しているスクリプトです。
#Whois commands
echo "Whois Scan Starting"
echo ""
echo "Please enter a domain name for a Whois lookup"
read dn
whois "$dn" > /root/Desktop/$client/Whois/whois.txt
read -rsp $'All done. Press enter to continue...\n'
read -p "Would you like to do another Whois lookup? [yn]" answer
if [[ $answer = y ]] ; then
#run the command
echo "Please enter a domain name for a Whois lookup"
read dn
whois "$dn" > /root/Desktop/$client/Whois/whois2.txt
read -rsp $'All done. Press enter to continue...\n'
fi
while ループを使用する必要があると思いますが、何度か試してみましたが、やりたいことができません。