Constant update echo in BASH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Constant update echo in BASH
# 1  
Old 05-07-2009
Question Constant update echo in BASH

Hi all,

Basically Im trying to put the current time in a script in BASH. Tried the watch command, but its not really what I want.

I will have lots of things in this script, current date and time being just a few).

Any ideas?
# 2  
Old 05-07-2009
man date
# 3  
Old 05-07-2009
Yes... that's not what i want. By current time, i meant constant current time. Not the time when the script is run. I want the time to constantly update while the script is running.
# 4  
Old 05-07-2009
What "time" is it that you want to update? Do you want to update this time in a file? On the screen?

Is it that you want to display a timer on the screen while your script runs, kind of like a progress bar, but instead of showing dashes or a percentage, you want to show a timer?
# 5  
Old 05-07-2009
The time like a clock. Basically, i am making a menu driven programme and i would like to have a "clock" on the top of each menu page.

The only way I have been able to make it work at the minute is by using the watch command as follows:

DATE FILE
Code:
echo "The time/date is: `date`"

COMMAND TO BE USED
Code:
watch ./date

However I planned to awk out the date to leave just the time, but the watch command takes up the full screen and doesnt allow menu inputs.. any other ideas?
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Red Hat

RedHat 5 update 9 BASH update issue

Hi i want to update the BASH because of the "shell shock" vulnerability. my RedHat 5 is clean install with the default mirror site. when im running the command: yum update bash im getting a message saying there is no update. you can see in the attach picture... what am i doing wrong? is... (4 Replies)
Discussion started by: guy3145
4 Replies

2. Shell Programming and Scripting

Basic bash, echo in loop for

Hi, I am trying to make a script to manage log. I want to write the name of the .gz I moved and the date : for i in `ls $replog/*.gz` do echo " $i " `echo $i date +%d:%m:%Y` `echo $datee `>> $replog/mrnet.log mv $i /var/log/vieux-logs done I need to echo... (10 Replies)
Discussion started by: Dabless
10 Replies

3. Shell Programming and Scripting

loop with a counter on a constant in bash

Hello Everyone, I'm in need of assistance on creating a script with a counter on a certain string. Basically this script opens a log file and displays certain log data. There are two key words in the log. START and FINISH. In between the START and FINISH is a variable ACTNUMBER. It will... (1 Reply)
Discussion started by: rxc23816
1 Replies

4. Shell Programming and Scripting

echo in bash

Why does echo supress line breaks in bash? I'm working on a script that starts like this: words=`sort list.txt | uniq` echo $words | wc -l I need to number the lines and then do other stuff. I'd use jot, but it's not installed, so I hope I can get seq to do what I want. But first I need to... (2 Replies)
Discussion started by: mregine
2 Replies

5. Shell Programming and Scripting

problem in bash echo

I am using the echo command to send the output to the file. I am using the following code: echo "service started successfully\n" > log But when I do: cat log I get: service started successfully\n Instead of a newline after the "successfully" Why is that and how can I fix it? (3 Replies)
Discussion started by: programAngel
3 Replies

6. UNIX for Advanced & Expert Users

echo in ksh sh & bash

Hello, I have lib file which contain a function that get text to print on screen by echo command. Several scripts are inculde this lib and use this function. Each one of them is written in different shell language (sh ksh & bash). This causing some issues when using backslash charater as... (4 Replies)
Discussion started by: Alalush
4 Replies

7. Shell Programming and Scripting

what is ksh equivalent of bash echo -n ?

Hi folks, I need to stop printing a new line after echoing a string in KSH. i know bash provides echo -n "string" what is the ksh equivalent for this ? (3 Replies)
Discussion started by: mudhireddy
3 Replies
Login or Register to Ask a Question