Sponsored Content
Top Forums UNIX for Dummies Questions & Answers problem in script involving month arithmetic Post 302154594 by Perderabo on Monday 31st of December 2007 02:16:19 PM
Old 12-31-2007
3,6,9,12 all have a remainder of zero when divided by 3. The other months will have a non-zero remainder. You can use month%3 as the test. If you must have variable called inc_flg with the above mentioned properties, you could just do:
((inc_flg=2-!(month%3)))
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix + oracle doubt....involving shell script

....does the dbms_output.put_line work inside unix shell script? i mean this is to be inside the sqlplus connection as follows!! sqlplus -s $UP <<EOJ .. .. .. dbms_output.put_line ('Insertion procedure failed for UPC BC : ' || wk_key_value || ' Sqlcode: ' || SQLCODE || ' Error... (2 Replies)
Discussion started by: mexx_freedom
2 Replies

2. UNIX for Dummies Questions & Answers

arithmetic problem

i am used to making scripts for hp-ux. but lately i tried to make some for solaris. the problem is that when i tried to execute it it gave me an error the "let: not found". why is that? how can i perform an arithmetic function in the solaris shell script? thanks :) (2 Replies)
Discussion started by: inquirer
2 Replies

3. Shell Programming and Scripting

problem in arithmetic operations

hello all, i am having a variable with a value of 0000010000 and if i add the variable with some no: suppose i=0000010000 n=`expr $i + 1` echo $n the output i am reciving is 10001 .it deletes all the zeros but i need result as 0000010001.. please help me... thanks in... (3 Replies)
Discussion started by: ithirak17
3 Replies

4. Programming

A challenging problem involving symbolic links.

Hello, I'm working on an application that bridges together several applications involved in creating a video workflow for editing with digital cinema cameras. The main platform is MacOSX. Because of the nature of some of the utilities for working with this video footage I must spoof filenames... (2 Replies)
Discussion started by: ibloom
2 Replies

5. Shell Programming and Scripting

Problem in expect script with password involving trailing backslash

Hi all, I have wriiten an expect script that genearates a public private key pair through ssh-keygen and then copies that key to the authorized keys file of the remote system . The problem i am facing is when i get a password for the remote machine containg a trailing backslash , the send command... (4 Replies)
Discussion started by: pradeeptyagi23
4 Replies

6. Shell Programming and Scripting

Arithmetic Problem with shell script programming.

Hello everybody, I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input. I... (1 Reply)
Discussion started by: Florinel76
1 Replies

7. Homework & Coursework Questions

Arithmetic Problem with shell script programming.

Hello everybody, I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input. I... (8 Replies)
Discussion started by: Florinel76
8 Replies

8. Shell Programming and Scripting

Script to counting a specific word in a logfile on each day of this month, last month etc

Hello All, I am trying to come up with a shell script to count a specific word in a logfile on each day of this month, last month and the month before. I need to produce this report and email it to customer. Any ideas would be appreciated! (5 Replies)
Discussion started by: pnara2
5 Replies

9. Shell Programming and Scripting

Help with simple bash script involving a loop

Dear unix wizards, I'd be very grateful for your help with the following. I have a hypothetical file (file.txt) with three columns: 111 4 0.01 112 3 0.02 113 2 0.03 114 1 0.04 115 1 0.06 116 2 0.02 117 3 0.01 118 4 0.05 Column 2 consists of pairs of integers from 1 to 4 (each... (5 Replies)
Discussion started by: aberg
5 Replies

10. Cybersecurity

Maybe a security problem involving Linux hosts

Hello, with the following problem I feel helpless because I do not know where to look for the problem. Sorry in advance for my poor English. At some point the interaction with people on Freenode IRC has become mysterious and offending so that I checked my modem/router device. When I tried to... (2 Replies)
Discussion started by: SInt
2 Replies
PARSEDATE(3)						   BSD Library Functions Manual 					      PARSEDATE(3)

NAME
parsedate -- date parsing function LIBRARY
System Utilities Library (libutil, -lutil) SYNOPSIS
#include <util.h> time_t parsedate(const char *datestr, const time_t *time, const int *tzoff); DESCRIPTION
The parsedate() function parses a datetime from datestr described in english relative to an optional time point and an optional timezone off- set in seconds specified in tzoff. If either time or tzoff are NULL, then the current time and timezone offset are used. The datestr is a sequence of white-space separated items. The white-space is optional the concatenated items are not ambiguous. An empty datestr is equivalent to midnight today (the beginning of this day). The following words have the indicated numeric meanings: last = -1, this = 0, first, next, or one = 1, second is unused so that it is not confused with ``seconds'', two = 2, third or three = 3, fourth or four = 4, fifth or five = 5, sixth or six = 6, seventh or seven = 7, eighth or eight = 8, ninth or nine = 9, tenth or ten = 10, eleventh or eleven = 11, twelfth or twoelve = 12. The following words are recognized in English only: AM, PM, a.m., p.m. The months: january, february, march, april, may, june, july, august, september, sept, october, november, december, The days of the week: sunday, monday, tuesday, tues, wednesday, wednes, thursday, thur, thurs, friday, saturday. Time units: year, month, fortnight, week, day, hour, minute, min, second, sec, tomorrow, yesterday. Timezone names: gmt, ut, utc, wet, bst, wat, at, ast, adt, est, edt, cst, cdt, mst, mdt, pst, pdt, yst, ydt, hst, hdt, cat, ahst, nt, idlw, cet, met, mewt, mest, swt, sst, fwt, fst, eet, bt, zp4, zp5, zp6, wast, wadt, cct, jst, east, eadt, gst, nzt, nzst, nzdt, idle. A variety of unambiguous dates are recognized: 69-09-10 For years between 69-99 we assume 1900+ and for years between 0-68 we assume 2000+. 2006-11-17 An ISO-8601 date. 10/1/2000 October 10, 2000; the common US format. 20 Jun 1994 23jun2001 1-sep-06 Other common abbreviations. 1/11 the year can be omitted As well as times: 10:01 10:12pm 12:11:01.000012 12:21-0500 Relative items are also supported: -1 month last friday one week ago this thursday next sunday +2 years Seconds since epoch (also known as UNIX time) are also supported: @735275209 Tue Apr 20 03:06:49 UTC 1993 RETURN VALUES
parsedate() returns the number of seconds passed since the Epoch, or -1 if the date could not be parsed properly. SEE ALSO
date(1), eeprom(8) HISTORY
The parser used in parsedate() was originally written by Steven M. Bellovin while at the University of North Carolina at Chapel Hill. It was later tweaked by a couple of people on Usenet. Completely overhauled by Rich $alz and Jim Berets in August, 1990. The parsedate() function first appeared in NetBSD 4.0. BUGS
1 The parsedate() function is not re-entrant or thread-safe. 2 The parsedate() function cannot compute days before the unix epoch (19700101). 3 The parsedate() function assumes years less than 0 mean - year, years less than 70 mean 2000 + year, years less than 100 mean 1900 + year. BSD
December 20, 2010 BSD
All times are GMT -4. The time now is 05:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy