LinuxQuestions.org
Review your favorite Linux distribution.
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-23-2004, 07:04 PM   #1
nafan
Member
 
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...
Code:
/usr/bin/make -s RELEASE="0.3.3-SVN $DATETIME"
Thanks in advance.
 
Old 08-23-2004, 09:04 PM   #2
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

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

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

Code:
/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 http://tldp.org/HOWTO/Adv-Bash-Scr-HOWTO/index.html

Arvind

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


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
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


All times are GMT -5. The time now is 06:09 PM.

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