[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

display seconds remain with sleep mode unix

Posted on 2007-11-18
6
Medium Priority
?
332 Views
Last Modified: 2011-10-03
hi i just have a quick question how do i display the seconds a sleep coomand stll has before it ontinues?
e.g
sleep 10

echo "you have x seconds before you can continue"
0
Comment
Question by:DSwiftie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Expert Comment

by:Talmash
ID: 20307730
do you want it counting down?
0
 

Author Comment

by:DSwiftie
ID: 20308143
yep def
0
 
LVL 48

Accepted Solution

by:
Tintin earned 400 total points
ID: 20308567
#!/bin/sh
secs=10

while [ $secs -gt 0 ]
do
     echo "You have $secs seconds before continuing"
     secs=`expr $secs - 1`
    sleep 1
done
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Talmash
ID: 20312042
little change to tintin's:

file = sleep_countdown:
#!/bin/sh
secs=$1

while [ $secs -gt 0 ]
do
     echo "You have $secs seconds before continuing"
     secs=`expr $secs - 1`
    sleep 1
done

chmod 755 sleep_countdown

sleep_countdown 30

you can change the resolution by setting it VIA $2 (set step = $2 ...)

tal
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20312395
Hi,

try this script (call it myscript)

count=$1
while test $count -gt 0
do
echo "time left $count \c"
sleep 1
count=`expr $count - 1`
echo "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
done
echo "\n"

you may use it as

myscript 30
0
 

Author Comment

by:DSwiftie
ID: 20316128
tin tin's one works thankyou all very much for ur help
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question