×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

assign formatted date to variable in CSH - HELP !

assign formatted date to variable in CSH - HELP !

assign formatted date to variable in CSH - HELP !

(OP)
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 ...


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


but this does not ...


% 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

RE: assign formatted date to variable in CSH - HELP !

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.

RE: assign formatted date to variable in CSH - HELP !

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close