date command


 
Thread Tools Search this Thread
# 1  
Ok,
I figured out how to code my LCD clock program the only problem I am now having is - making it print out.

I have my for loops and case statements in my program and after that I need to print out the time I know how to use the date with the cut command. But I am unsure on how to link my statements so that the time is printed out, after the case statements.

A
# 2  
If I was going to print your project, I would write the output of your script to a file instead of the console (screen) and just print the file. For example, if your script is called sh_foo, just do an sh_foo > file.txt Then just print file.txt. Is there any reason you can't do this?

[Edited by Neo on 11-09-2000 at 11:51 PM]
# 3  
Are you talking about printing it to the screen, or printing out a hard copy?

If you mean to the screen, then you might have something like:
Code:
FOO=`date +%H|cut -c1`

case $FOO in 
          2) echo "<some text>"
             ;;
          3) echo "<some text>"
             ;;
esac


I dont know how your program is set up, but it sounds like you are using case statements. You would put the output (echo) in the appropriate portion of the case.
Read the bash or ksh man page for information on how to use the case statement.

I would recommend that you pick up a good Unix book that includes a section on shell scripting. Several have been recommended in different threads recently on this board.

HTH
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

current date command runs well awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat subtract 30 days fails awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies

2. Shell Programming and Scripting

Date command

Hi Is there any way to find out one day after from the current date I know well the date command can get one day ago from current date date +%Y:%m:%d -d "1 day ago" 2016:06:21 date +%Y:%m:%d 2016:06:22 The same way I need output for one day after which is 24 hr + from the... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

3. HP-UX

HP/UX command to pull file name/date based on date

HI, Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
Discussion started by: lnemitz
2 Replies

4. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

5. Shell Programming and Scripting

How to get tomorrow,yesterday date from date Command

Hi I want to get tomorrow and yesterday date from date command. My shell is KSH and server is AIX. I tried several options, but unable to do. Please help on this. Regards Rajesh (5 Replies)
Discussion started by: rajeshmepco
5 Replies

6. AIX

Help with date command

How do i get tomorrows date with date command ON AIX system. I tried using date --date="next day" but the same does not work. Please advise. -SK (5 Replies)
Discussion started by: Siddheshk
5 Replies

7. Shell Programming and Scripting

how to obtain date and day of the week from `date` command

Hi, does anybody know how to format `date` command correctly to return the day of the week? Thanks -A I work in ksh.... (1 Reply)
Discussion started by: aoussenko
1 Replies

8. Shell Programming and Scripting

want to get previous date from date command in ksh

I want to get previous date from date command. I am using ksh shell. Exmp: today is 2008.09.04 I want the result : 2008.09.03 Please help. Thanks in advance. (4 Replies)
Discussion started by: rinku
4 Replies

9. Shell Programming and Scripting

Date command

Hello Forum, I want to retrieve the old date from "date" command. For example: It's 02 Nov today and i want 7 days old date say 25 oct then how can i do that??? As i do date | awk '{print $3-7}' It returns -5 (As 2-7) So can anyone help me to solve this out..... I think by making... (3 Replies)
Discussion started by: lokesh.sharma
3 Replies

10. UNIX for Dummies Questions & Answers

date command

hello i am confused about my system date when i give date command i get wrong date i want to fix the date to current date when i strat my system i am using the SUSE Linux (2 Replies)
Discussion started by: vshyam4949
2 Replies

Featured Tech Videos