display changing variable in one place on screen in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting display changing variable in one place on screen in ksh
# 8  
Old 09-25-2008
ksh93 has the undocumented alarm feature which can be used to display something or do something on a regular basis.

Here is a trivial example to display the time on every second
Code:
#!/usr/bin/ksh93

alarm -r a +1
function a.alarm { print -n "$(date +%H:%S)\r"; }
read dummy      # wait

From an email by Dave Korn ...
Quote:
alarm remains undocumented since I have not decided what interface I want for this functionality. ksh93 has the ability to handle multiple timeout events and alarm is a built-in that can enable them.
.....
Usage: alarm [-r] [varname seconds] where -r means periodically, varname is a variable name, and seconds can be of absolute from the epoch or of the form +n.

In addition, the alarm builtin allows the alarm discipline function to be specified which gets invoked when the timer goes off. For example, if you have the title function (which is distributed with ksh93, and which updates the title bar, then

alarm -r var +1
function var.alarm
{
title $(printf "%T")
}

will update the title bar with the current date/time every second.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Changing dpi screen resolution in Solaris 10.

Hi, everyone! I would like to try OpenStep for Solaris on my Sun Ultra 10 machine, so I installed all required packages, the problem is that OpenStep requires screen DPI to be set to 72x72 while my current dpi is 90x90. So how do I change the dpi? Thank you! (0 Replies)
Discussion started by: nongrato
0 Replies

2. Shell Programming and Scripting

Print one's place for 1 to N times, ksh Perl whatever?

Hello all, I would like to create a for loop or whatever is quick that will print the one’s place of a number for 1-N times say for example a printed page formatting is 132 characters wide, I would like a single line 123456789012345678901234567890... ...012 That is 132 characters long. I... (11 Replies)
Discussion started by: KmJohnson
11 Replies

3. UNIX for Advanced & Expert Users

How to display the files on screen

I connect via vnc to a linux computer. after a logout, I cannot see the files on the screen (although i can see the screensaver). I can open a terminal and see the files etc. How can i see the files on the screen again? (5 Replies)
Discussion started by: FelipeAd
5 Replies

4. UNIX for Dummies Questions & Answers

Changing the screen resolution

I have installed several flavors of Linux and FreeBSD onto my machine. Now when I want to change my screen resolution, it only has one option which is 800x600. Is there a way to change that to a bigger resolution? And if there is, what file do I have to edit and what text editor do I have to use?... (2 Replies)
Discussion started by: figaro
2 Replies

5. Shell Programming and Scripting

ksh - truncate a log in place, sed -i not available captain!

Hi there:) Because of security requirements, It would be much better if I could truncate my logs in place using sed -i (or ?). I cant use the -i option on sed in my environment. Can anyone help a DBA? (5 Replies)
Discussion started by: quigley007
5 Replies

6. AIX

CDE running but not display on screen

Runing p550Q via HMC I'd like to start using graphic interface CDE: lslpp -l | grep X11.Dt* X11.Dt.ToolTalk -- AIX CDE ToolTalk Support X11.Dt.bitmaps -- AIX CDE Bitmaps X11.Dt.helpmin -- AIX CDE Minimum Help Files X11.Dt.helprun -- AIX CDE Runtime Help X11.Dt.lib -- AIX CDE... (0 Replies)
Discussion started by: silves
0 Replies

7. UNIX for Dummies Questions & Answers

Changing my Screen Resolution (Not in X)

I have no graphical environment, no X, just a shell... but its WAY bigger than my monitor... what do I do? (3 Replies)
Discussion started by: jjinno
3 Replies

8. Shell Programming and Scripting

screen display help

Hello All, I have a file that is formatted like this 1234556 1234567 1234588 1123888 1999999 1010101 1919191 1919191.... for a total of 26000 + lines how do I get a script to read lets say 50 lines at a time and display the output to the screen in column format around 5 or 6... (2 Replies)
Discussion started by: zilla30066
2 Replies

9. Solaris

Changing Screen Resolution

I have installed Solaris 10 over vmware onto my machine. Now when I want to change my screen resolution it only has one option which is 800x600. Is there a way to change that to a bigger resollution? And if there is, what file do I have to edit and what text editor do I have to use? (1 Reply)
Discussion started by: Aco
1 Replies

10. Shell Programming and Scripting

controlling screen display

How can I control the screen output when trying to read a large file onto the screen x number of lines at a time. I'm trying to use this is a bourne shell script. I want to display 10 lines of a file, pause the screen so that a user can read the file, and then display the next 10 lines of the file,... (6 Replies)
Discussion started by: jrdnoland1
6 Replies
Login or Register to Ask a Question
times(1)							   User Commands							  times(1)

NAME
times - shell built-in function to report time usages of the current shell SYNOPSIS
sh times ksh times DESCRIPTION
sh Print the accumulated user and system times for processes run from the shell. ksh Print the accumulated user and system times for the shell and for processes run from the shell. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
ksh(1), sh(1), time(1), attributes(5) SunOS 5.10 15 Apr 1994 times(1)