Sponsored Content
Top Forums UNIX for Dummies Questions & Answers problem in script involving month arithmetic Post 302154450 by VISH on Sunday 30th of December 2007 12:15:16 PM
Old 12-30-2007
MySQL

u can directly subtituite command in loop u can do this it worksSmilie Smilie

#!/bin/sh

if [ `date +"%m"` -eq 3 ] | [ `date +"%m"` -eq 6 ] | [ `date +"%m"` -eq 9 ] | [ `date +"%m"` -eq 12 ] ; then
echo "inc_flg = 1"
else
echo "inc_flg = 2"
fi
 

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
DATETIME.SETISODATE(3)							 1						    DATETIME.SETISODATE(3)

DateTime::setISODate - Sets the ISO date

       Object oriented style

SYNOPSIS
public DateTime DateTime::setISODate (int $year, int $week, [int $day = 1]) DESCRIPTION
Procedural style DateTime date_isodate_set (DateTime $object, int $year, int $week, [int $day = 1]) Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3). The function modifies this object. o $year - Year of the date. o $week - Week of the date. o $day - Offset from the first day of the week. RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Changed the return value on success from NULL to | | | DateTime. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.setISODate(3) example Object oriented style <?php $date = new DateTime(); $date->setISODate(2008, 2); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; ?> Procedural style <?php $date = date_create(); date_isodate_set($date, 2008, 2); echo date_format($date, 'Y-m-d') . " "; date_isodate_set($date, 2008, 2, 7); echo date_format($date, 'Y-m-d') . " "; ?> The above examples will output: 2008-01-07 2008-01-13 Example #2 Values exceeding ranges are added to their parent values <?php $date = new DateTime(); $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 8); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 53, 7); echo $date->format('Y-m-d') . " "; ?> The above example will output: 2008-01-13 2008-01-14 2009-01-04 Example #3 Finding the month a week is in <?php $date = new DateTime(); $date->setISODate(2008, 14); echo $date->format('n'); ?> The above examples will output: 3 SEE ALSO
DateTime.setDate(3), DateTime.setTime(3). PHP Documentation Group DATETIME.SETISODATE(3)
All times are GMT -4. The time now is 10:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy