![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| why the date format dont work in crontab | p4cldba | UNIX for Advanced & Expert Users | 7 | 06-30-2008 08:09 PM |
| date issue-find prevoius date in a patricular format | bsandeep_80 | UNIX for Advanced & Expert Users | 3 | 11-15-2007 08:42 PM |
| convert mmddyy date format to ccyyddd format?? | Bhups | Shell Programming and Scripting | 2 | 09-27-2006 11:30 PM |
| Date format - Shell scripting gurus please help | geomonap | Shell Programming and Scripting | 3 | 02-02-2006 05:15 AM |
| convert date in lilian format for shell (AIX) | chocolate | AIX | 2 | 11-09-2004 04:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Date Format Does not work in Shell
I'm am able to format the date in the unix prompt using NOW=$(date +"%d%m%y"). However, when i put the same format into a shell script, it errors out with the followign.
sintax error on line 4: `NOW=$' unexpected. #!/bin/ksh EXP_LOC=/u02/oradata/exports NOW=$(date +"%d%m%y") echo $NOW ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "test" 13 lines, 363 characters |
|
|||||
|
Can you try a simpler command? Perhaps just setting with date like in my second assignment in my script. Maybe your system does not like part of the date options??
Code:
> cat date_scr #!/bin/ksh EXP_LOC=/u02/oradata/exports NOW=$(date +"%d%m%y") echo $NOW NOW2=$(date) echo $NOW2 > ksh date_scr 101008 Fri Oct 10 08:24:26 PDT 2008 > |
|
||||
|
Quote:
I tried the other way you suggested and worked fine. thanks. |
|
||||
|
if i don't use the sh infront of the script, it does not run
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|