我做了一個簡單的whois腳本,返回域的whois信息。一旦完成,它會返回到原始終端,如下所示。如何循環/重新啓動perl腳本?
[email protected]:; perl script.pl
Enter domain name: name.com
etc... whois information displays here.
[email protected]:;
最後,「user @ ubuntu」返回,我怎麼才能讓它回到開始?
我想循環它。
我做了一個簡單的whois腳本,返回域的whois信息。一旦完成,它會返回到原始終端,如下所示。如何循環/重新啓動perl腳本?
[email protected]:; perl script.pl
Enter domain name: name.com
etc... whois information displays here.
[email protected]:;
最後,「user @ ubuntu」返回,我怎麼才能讓它回到開始?
我想循環它。
你可以這樣做:
while [ /bin/true ]
do
perl script.pl
sleep 1
done
while(1){ #您當前的代碼在這裏# } 這就是我一直在尋找的。 – Helloz
在Perl中,
while (1) { print "Enter domain name: "; my $domain = <>; last unless $domain && $domain =~ /\w/; domain =~ s/\s+//g; #super-chomp is good idea your code here... }
使用兩階段,除非情況下產生EOF作爲UNDEF我不想民主基金=〜/ \ W /在嚴重警告級別上產生運行時警告。
與剛剛運行它有什麼不同? – Thilo
你問在perl/bash中如何做循環? – TLP