Created
November 15, 2019 09:10
-
-
Save easternnl/9b0c1d3cef6f2938ca6eb1e72741adf5 to your computer and use it in GitHub Desktop.
A timeout/pause function which will display how long the user needs to wait before the script continues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$| = 1; # flush everything directly to the output buffer | |
timeout(10); | |
sub timeout | |
{ | |
my $wait = shift; | |
for (my $i=$wait; $i > -1; $i--) | |
{ | |
print STDOUT "\rWaiting for $wait seconds, $i to go "; | |
sleep(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment