LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-08-2006, 08:23 AM   #1
ancys
LQ Newbie
 
Registered: Jul 2006
Posts: 28

Rep: Reputation: 15
Regarding date Format


hi all
In table sample column process_date datatype is Date

in unix script i m getting the current date and that value should be updated in process_date
#!bin/sh
start_date=`date '+%d%m%y'`

/oraclepath uname/pwd@dbname<<EOF
update samp
set process_date='$start_date'
EOF

But values is not updated how to update the value in this column
help please!!!
 
Old 08-08-2006, 08:45 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
You have a typo in the shebang, should be #!/bin/sh
Maybe this example will help.
Code:
#!/bin/sh

start_date=$(date '+%d%m%y')

FILE=file.txt
(
cat << EOF
update samp
set process_date='$start_date'
EOF
) > $FILE
 
Old 08-08-2006, 08:53 AM   #3
ancys
LQ Newbie
 
Registered: Jul 2006
Posts: 28

Original Poster
Rep: Reputation: 15
The above mentioned code does not update the Process_date column
 
Old 08-09-2006, 12:16 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Single quotes in bash do not allow interpolation (ie does not translate varname to varvalue). Try double quotes.
 
Old 08-10-2006, 05:35 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,276

Rep: Reputation: 170Reputation: 170
I assume you aren't running it on linux?
Try #!/bin/ksh(i prefer) or #!/bin/bash

linux /bin/sh is bash, not real bourne shell so will work
the unix version of /bin/sh code will not work
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'date' command format Neorio Linux - General 3 01-18-2011 05:18 AM
Need workaround for Date Format Cyberdyne Slackware 2 07-22-2005 04:36 AM
A question regarding the date format marsques Linux - General 1 03-12-2005 05:28 PM
Date format Mik LQ Suggestions & Feedback 8 12-05-2004 10:14 AM
MySQL date format mnauta Linux - General 2 05-13-2004 06:20 PM


All times are GMT -5. The time now is 04:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration