Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 08-23-2004, 07:04 PM   #1
Registered: May 2004
Location: /dev/bed
Distribution: Mandriva 2009.0 Powerpack
Posts: 172

Rep: Reputation: 30
Setting environment variable to current date/time

I've been trying to find out if there is a way of setting an environment variable ($DATETIME) with the current date & time , but I've had no luck. Any pointers on how to do it would be greatfully received. It's my intention to use the variable in a bash shell script in a command similar to...
/usr/bin/make -s RELEASE="0.3.3-SVN $DATETIME"
Thanks in advance.
Old 08-23-2004, 09:04 PM   #2
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 16
DATETIME="`date +%d%m%y%H%M%S`"
/usr/bin/make -s RELEASE="0.3.3-SVN $DATETIME

DATETIME=$(date +%d%m%y%H%M%S)
or even:

/usr/bin/make -s RELEASE="0.3.3-SVN $(date +%d%m%y%H%M%S)
Please read the Bash (or some other shell's) manual, or the "Advanced Bash Scripting Howto" at


Last edited by arvind_sv; 08-23-2004 at 09:09 PM.


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
environment variable setting chii-chan Linux - General 5 01-23-2009 07:29 PM
setting environment variable kb_ganesh Ubuntu 3 09-10-2005 01:58 PM
Setting up a environment variable Hiper1 Linux - Newbie 3 03-08-2005 08:43 AM
edit path environment variable to include current working directory alb1954 Linux - Newbie 8 07-11-2004 11:26 PM
Setting an environment variable kharris Linux - General 3 10-02-2003 04:38 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:12 PM.

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