Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

assign formatted date to variable in CSH - HELP ! 1

Status
Not open for further replies.

Advocate

IS-IT--Management
Oct 18, 2000
135
GB
good morning campers

trying to learn unix & scripting (steep learning curve) to satisfy a client's 'jack of all trades' requirements (isnt life fun ...)

client standard is c shell (csh) for all scripts (NOT MY DECISION ...)

trying to assign date value to variable; this works ok ...

Code:
% date +"%d%m%Y"
25072001

but this does not ...

Code:
% TODAY=`date +"%d%m%Y"`
TODAY=25072001: Command not found.
% echo $TODAY
TODAY: Undefined variable.

any thoughts please ?

IBM AIX 4.3 in case it makes any difference (i have found out the hard way that there are subtle differences ...)

thank you in advance ...
Best of Irish Luck, David.
djwilkes@hotmail.com
 
I don't use csh much myself. It's a different animal, isn't it? Anyway, this should achieve what you want but it may not be the best way to do it. The spaces are important.

set TODAY = `date +"%d%m%Y"`

Greg.
 
grega

that works ok in my script now ...

i realise now that CSH needs
set variable=

while KSH etc uses
variable=

may the wind always be at your back

thanks
Best of Irish Luck, David.
djwilkes@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top