Hi, I'm new with Unix, I'm trying to get a last day of previous month with this format: %b %d %Y (example: Feb 25 2008).
Here is what I have so far.
#!/bin/ksh
cur_month=`date +%m`
cur_year=`date +%Y`
prev_month=$(($cur_month-1))
# Check to see if this is January
if
then
... (11 Replies)
Hello,
I wanted to display the month for previous day date. Like, today date is 18-Nov-2008. So the previous date is 17-Nov-2008. The output should be November.
If the today date is 1-DEC-2008, then output should be NOVEMBER.
If the today date is 1-JAN-2008, then output should be DECEMBER.... (4 Replies)
Hello,
I'm new to shell scripting.
We've develop a script which will grep a file on the search criteria, MON (Jan/Feb/Mar/etc). But we should set this sript in cron which will run on every first day of the month. The problem I'm having is, when I run the script, it is displaying the contents of... (7 Replies)
Hi All,
I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this.
My Requirment is as below:
Input for me will be 2000909(YYYYMM)
I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Hi,
On any given day, I want to capture the month that has gone by - said otherwise, how do I capture last month?
expr date '+%m' - 1
Above expression is giving error.
Please advise
thanks
---------- Post updated at 09:28 AM ---------- Previous update was at 09:11 AM... (1 Reply)
Hi,
i unable to get the last month date in AIX.
current date - one month
Based on the forums tried but did not find the relevent information.
Any help grealy appriciated.
Thanks
Suri. (3 Replies)
Hi All,
I am using the below code to get the year and month from date:
Below gives output like 201212.
dt=`date '+%Y%m'`
how do i get the previous month value(ie: subtract 1 from date)
example output:
dt=201211
Please help. :confused: (3 Replies)
I have requirment to get last date of previous month and the first date of previous 4th month:
Example:
Current date: 20130320 (yyyymmdd)
Last date of previous month: 20130228 (yyyymmdd)
First date of previous 4th month: 20121101 (yyyymmdd)
In my shell --date, -d, -v switches are not... (3 Replies)
I am running a script in ksh to get the 2 months back date from system date.The below code is giving correct date output from putty command prompt.But while running the script is .ksh file it is giving the error below.Please suggest.
; d=a; y=a
m-=num
while(m < 1) {m+=12; y--}... (1 Reply)
Discussion started by: hini
1 Replies
LEARN ABOUT OPENSOLARIS
let
let(1) User Commands let(1)NAME
let - shell built-in function to evaluate one or more arithmetic expressions
SYNOPSIS
ksh
let arg...
ksh93
let [expr...]
DESCRIPTION
ksh
Each arg is a separate arithmetic expression to be evaluated.
ksh93
let evaluates each expr in the current shell environment as an arithmetic expression using ANSI C syntax. Variables names are shell vari-
ables and they are recursively evaluated as arithmetic expressions to get numerical values. let has been made obsolete by the ((...)) syn-
tax of ksh93(1) which does not require quoting of the operators to pass them as command arguments.
EXIT STATUS
ksh
ksh returns the following exit values:
0 The value of the last expression is non-zero.
1 The value of the last expression is zero.
ksh93
ksh93 returns the following exit values:
0 The last expr evaluates to a non-zero value.
>0 The last expr evaluates to 0 or an error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO ksh(1), ksh93(1), set(1), typeset(1), attributes(5)SunOS 5.11 2 Nov 2007 let(1)