year % 2 is 0 (i.e. false) if the year is even, and 1 (i.e. true, as is any non-zero value in C) if the year is odd. % is the "modulus" or "remainder" operator.
I am trying to change this :
Albert Einstein 52
Peter Scott 22
Hilary Smith 48
Joan Bakewell 30
Catherine Maguire 26
into
Albert Einstein Pass
Peter Scott Fail
Hilary Smith Pass
Joan Bakewell Fail
Catherine Maguire Fail
I have to use a if statement that says:
if field 3 is... (2 Replies)
I had different problem scenarios with IF statement. Can any expert please enlighten me on the difference with these scenarios. Thank you.
1st Scenario:
testdate=`date +%Y%m`
test=`cat /var/log/database0.$testdate*.log | grep "Errors found during processing" | tail -10`
if
then
... (4 Replies)
I am kind of new in Unix and i have to make a menu. I want to put an if statement in the menu. you should enter the filename and it goes to that file. How do i do this? (1 Reply)
Good morning all!
I want to know if Im interpreting this if statement below right.
if(((1) || (0)) && (1)){
do stuff;
}
This is saying: if true piped into false, then true, then do stuff. Right?
What does the && stand for?
thanks in advance!
ben (3 Replies)
I am writing a script that does a search for a argument in a file and lists all like occurrences. The script verifies that it is a file and then runs another script that list the lines. My problem is that I need the script to accept a file or a directory and then go to that directory check all... (1 Reply)
Hi
I am very new to Unix programming and shell scripting. I am trying t figure out how to write a little script that will output the number of directories. I can find the number of directories using ls -l | grep "^d" | wc -l I can not figure out how to do it so when I type the name... (8 Replies)
Hi guys,
Two problems I need solving please. I created a script where the user types in 7 numbers as standard input and each one is then stored in an array. Now I need to perform the following calculations on those numbers:
1) Use a while loop to determine the largest number in the range.
... (2 Replies)
1. The problem statement, all variables and given/known data:
Two problems I need solving please. I created a script where the user types in 7 numbers as standard input and each one is then stored in an array. Now I need to perform the following calculations on those numbers:
1) Use a while... (11 Replies)
I came across a bash script that outputs the forecast for the day and the max temperature but at the end of the day the max temperature disappears ($6) and I am left with "°C" after the forecast.
Here is the script:
#! /bin/bash
curl -s --connect-timeout 30... (7 Replies)
Discussion started by: _light_
7 Replies
LEARN ABOUT REDHAT
datetime
datetime(3) Library Functions Manual datetime(3)NAME
datetime - convert between TAI labels and seconds
SYNTAX
#include <datetime.h>
void datetime_tai(&dt,t);
datetime_sec datetime_untai(&dt);
struct datetime dt;
datetime_sec t;
DESCRIPTION
International Atomic Time, TAI, is the fundamental unit for time measurements. TAI has one label for every second of real time, without
complications such as leap seconds.
A struct datetime variable, such as dt, stores a TAI label. dt.year is the year number minus 1900; dt.mon is the month number, from 0
(January) through 11 (December); dt.mday is the day of the month, from 1 through 31; dt.hour is the hour, from 0 through 23; dt.min is the
minute, from 0 through 59; dt.sec is the second, from 0 through 59; dt.wday is the day of the week, from 0 (Sunday) through 6 (Saturday);
dt.yday is the day of the year, from 0 through 365.
The datetime library supports more convenient TAI manipulation with the datetime_sec type. A datetime_sec value, such as t, is an integer
referring to the tth second after the beginning of 1970 TAI. The first second of 1970 TAI was 0; the next second was 1; the last second of
1969 TAI was -1. The difference between two datetime_sec values is a number of real-time seconds.
datetime_tai converts a datetime_sec to a TAI label.
datetime_untai reads a TAI label (specifically dt.year, dt.mon, dt.mday, dt.hour, dt.min, and dt.sec) and returns a datetime_sec.
SEE ALSO now(3)datetime(3)