Thank you, but I don't have much time for learning how the screen works, so I would be glad to find some other way. Here is a test srcipt that I came up with so far:
I would like, for example, the child process to print the time in the third line of the terminal, and the parent - just write "parent" multiple times in 4th line, in the same place, by overwriting the previous one. But both processes seem to be writing in the same line - can it be fixed somehow?
I am taking a class in UNIX and have written a script that needs to countdown from a number that is read in from the keyboard to zero. If no number is given the start of the countdown should default to 10.
I can't get this to do the default
#! /bin/sh
echo Enter a number here to countdown... (2 Replies)
I am looking for a way to display on a single line, a running countdown for a given amount of time in a terminal using a bash script.
I am looking for this to use as part of a larger bash script that captures Video. The script sets up a bunch of parameters for DVgrab, and one of the parameters... (11 Replies)
Hi guys, I've found two nifty little scripts on these forums one which detects if the F5 key has been pressed:
#/bin/sh
_key()
{
local kp
ESC=$'\e'
_KEY=
read -d '' -sn1 _KEY
case $_KEY in
"$ESC")
while read -d '' -sn1 -t1 kp
do
_KEY=$_KEY$kp
... (0 Replies)
Hi all,
Does anyone know of any FUN countdown script that I can use for my script? At the moment, am just using sleep 10 or more and then print stuff into the screen to allow more time for the user to decide whether they want to continue running the script or abort?
Just thought of wanting... (3 Replies)
In the below bash when the perl is it possible to hide the commands from running on screen and display a process countdown?
For example, on the cygwin screen now the user sees each process in the command running as running protocol refGene, running protocol popfreq_all, etc... Could a... (0 Replies)
I have a bash with several processes in it, that I would like to include a progress bar or percentage complete. Below are two separate processes that, so the user knows that something is happening, there is an an indicator for each process.
Maybe, at the start of each new process a printf the... (2 Replies)
I would like this to work with seconds as well.
#!/bin/bash
#
if ; then
echo "Incorrect usage ! Example:"
echo './CountDown.sh -d "Jun 10 2011 16:06"'
echo 'or'
echo './CountDown.sh -m 90'
exit 1
fi
now=`date +%s`
if ; then
until=`date -d... (7 Replies)
Hello. I am pretty new to unix and shell scripting and I was wondering if there might be a way to banner a countdown timer inside a script. We currently have an existing script that does a 2 minute sleep but thought it might be fun to actually make it banner a countdown timer until it is finished.... (3 Replies)
Discussion started by: thumbelina
3 Replies
LEARN ABOUT BSD
getitimer
GETITIMER(2) System Calls Manual GETITIMER(2)NAME
getitimer, setitimer - get/set value of interval timer
SYNOPSIS
#include <sys/time.h>
#define ITIMER_REAL 0 /* real time intervals */
#define ITIMER_VIRTUAL 1 /* virtual time intervals */
#define ITIMER_PROF 2 /* user and system virtual time */
getitimer(which, value)
int which;
struct itimerval *value;
setitimer(which, value, ovalue)
int which;
struct itimerval *value, *ovalue;
DESCRIPTION
The system provides each process with three interval timers, defined in <sys/time.h>. The getitimer call returns the current value for the
timer specified in which in the structure at value. The setitimer call sets a timer to the specified value (returning the previous value
of the timer if ovalue is nonzero).
A timer value is defined by the itimerval structure:
struct itimerval {
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
};
If it_value is non-zero, it indicates the time to the next timer expiration. If it_interval is non-zero, it specifies a value to be used
in reloading it_value when the timer expires. Setting it_value to 0 disables a timer. Setting it_interval to 0 causes a timer to be dis-
abled after its next expiration (assuming it_value is non-zero).
Time values smaller than the resolution of the system clock are rounded up to this resolution (on the VAX, 10 milliseconds).
The ITIMER_REAL timer decrements in real time. A SIGALRM signal is delivered when this timer expires.
The ITIMER_VIRTUAL timer decrements in process virtual time. It runs only when the process is executing. A SIGVTALRM signal is delivered
when it expires.
The ITIMER_PROF timer decrements both in process virtual time and when the system is running on behalf of the process. It is designed to
be used by interpreters in statistically profiling the execution of interpreted programs. Each time the ITIMER_PROF timer expires, the
SIGPROF signal is delivered. Because this signal may interrupt in-progress system calls, programs using this timer must be prepared to
restart interrupted system calls.
NOTES
Three macros for manipulating time values are defined in <sys/time.h>. Timerclear sets a time value to zero, timerisset tests if a time
value is non-zero, and timercmp compares two time values (beware that >= and <= do not work with this macro).
NOTES (PDP-11)
On the PDP-11, setitimer rounds timer values up to seconds resolution. (This saves some space and computation in the overburdened PDP-11
kernel.)
RETURN VALUE
If the calls succeed, a value of 0 is returned. If an error occurs, the value -1 is returned, and a more precise error code is placed in
the global variable errno.
ERRORS
The possible errors are:
[EFAULT] The value parameter specified a bad address.
[EINVAL] A value parameter specified a time was too large to be handled.
SEE ALSO sigvec(2), gettimeofday(2)4.2 Berkeley Distribution August 26, 1985 GETITIMER(2)