Need assistance to resolve the KSH issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need assistance to resolve the KSH issue
# 8  
Old 11-16-2009
Hi.

The date now +6 days doesn't work on my Linux.

As you're using Oracle anyway, why not let it deal with it?

Code:
sysdate + 6

will give you the date you're looking for.

There's no hint in your code where you actually intend to use the future date.
# 9  
Old 11-18-2009
Hi,

date now +6 days '+%m/%d/20%y' is not working in solaris.

And I need to do in the shell itself. I cant do in oracle prompt. because the requirement is as such.

So can u pls help me to find the date of currentdate+6 days?
# 10  
Old 11-18-2009
I's working with OpenSolaris (and Solaris if you install gnu date):
Code:
$ uname -a 
SunOS pcjll 5.11 snv_118 i86pc i386 i86pc
$ /usr/gnu/bin/date -d "now +6 days" "+%m/%d/%Y"
11/24/2009

I fixed the Y2.1K bug Smilie

If you need something only based on already installed tools, you might use that perl oneliner:
Code:
$ perl -MPOSIX -e 'print strftime("%m/%d/%Y%n",localtime(time+6*24*60*60));'
11/24/2009

# 11  
Old 11-18-2009
Thanks for the quick reply.

I think gnu is not installed for me.

$ uname -a
SunOS osp2pits03-th 5.10 Generic_118833-02 sun4u sparc SUNW,Sun-Fire-V440

But perl -MPOSIX -e 'print strftime("%m/%d/%Y%n",localtime(time+6*24*60*60));' is working fine.

shall I use this perl line in a k shell? am new to shell script.that's why am asking.

any my exact requirement as such

inputdate=25/11/2009
requiredate=$inputdate+6
echo "$requiredate"

I tried through the following way.

$ noofdays=$1
$ totaldays=24*noofdays
$ next_date=`TZ=CST-$totaldays date +%d/%b/%Y `
$ echo "$next_date"
19/Nov/2009
$ noofdays=$1
$ inputdate=$2
$ totaldays=24*noofdays
$ future_date=`TZ=CST-$totaldays $inputdate `
$ echo $future_date

but $future_date is giving blank output.

pls help to sort out this. or is there anyother simple way than this?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh while read issue

Hello, I have used a chunk of ksh script similar to this in many places without any issue: while : do print; read OPTION?"Enter a number (q to quit): " expr ${OPTION} + 1 >/dev/null 2>&1 CHECKVAL=$? if }" != ${OPTION} ]; then ... (2 Replies)
Discussion started by: port43
2 Replies

2. Shell Programming and Scripting

Need assistance in ksh script

requirement : I need to read a text file and find out which particular line has highest charcters on it using the shell script. I tried & was able to find out only for one line. I could not able to find out for the entire the line. sed -n '10 p' ctstest.sh | wc -w Please guide me... (5 Replies)
Discussion started by: ramkumar15
5 Replies

3. Solaris

Cannot resolve PTR record issue

Hi guys, I am currently receiving the following output in /var/log/syslog and is occurring every second leading to /var directory being full after every 2 days. Aug 20 17:32:29 opaldn1 sendmail: r7KCOlQm002517: ruleset=check_rcpt, arg1=<postmaster@silverapp6>, relay=, reject=450 4.4.0... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies

4. Shell Programming and Scripting

-z in ksh issue

Hi, Can any body please tell me what does -z do in ksh? I need to understand what does below code do? FILE_LIST is an array which store multiple number of files... if } ]]; then echo "EVDO file not found fi I hope I'm clear on my query (3 Replies)
Discussion started by: annybase
3 Replies

5. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies

6. Shell Programming and Scripting

ksh: How do I resolve ip addr in a text file?

Hi, I need to resolve IP to names in a text file. I was thinking of using some unix commands. Ksh. Text in file contains a lot of these entries: .. 20 6 <166>%ASA-6-302013: Built inbound TCP connection 12690562 for inside2:10.86.6.20/3678 (10.86.6.20/3678) to inside:10.107.22.12/1947... (3 Replies)
Discussion started by: hasselhaven
3 Replies

7. Shell Programming and Scripting

basename issue with ksh

I have a function name called help as below function help { echo "Run the script as," #echo "$(basename $0) -sod or -eod" echo "${0##*/} -sod or -eod" } and have case stmt which will call this function incase of wrong parameter but when ever I'm giving wrong... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

8. UNIX for Dummies Questions & Answers

Can any good awk'er resolve this issue?

awk -F^ '{ if ((($1 != "M") && ($5 != "2")) || (($1 != "S") && ($5 != "7"))) print $0}' welcome > welcome1 The "&&" and "||" in the above command is not working with awk. When I run the above command, the same content of welcome is copied to welcome1 without any difference. Your reply is... (12 Replies)
Discussion started by: karthickrn
12 Replies

9. Shell Programming and Scripting

KSH Script Assistance

Hey everyone, I'm newer than new when it comes to this ksh and scripting stuff, and unix in general. I have been thrown into a task at work that A: They expect me to come up to speed on, B: Show I can do this. (Program for the workgroup) Here's the script, part of it, from the overall... (3 Replies)
Discussion started by: Brusimm
3 Replies
Login or Register to Ask a Question