LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 02-09-2004, 12:07 PM   #1
linuxdev
Member
 
Registered: Feb 2004
Posts: 34

Rep: Reputation: 15
user defined variables


How can I store the value of "system date" in some variable and use that value in my script...

I tired
var=date;
echo $var.................( in my script)

I know something is wrong here but how can I get the date in some variable ....
and once I get the date in some variable...I want to concantenate that value with some
string in my script....

PLs any insights..
Thanks
 
Old 02-09-2004, 12:16 PM   #2
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
try var=`date`
 
Old 02-09-2004, 12:31 PM   #3
linuxdev
Member
 
Registered: Feb 2004
Posts: 34

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Demonbane
try var=`date`

var='date'
echo $var
Its not working somehow.....
 
Old 02-09-2004, 12:34 PM   #4
linuxdev
Member
 
Registered: Feb 2004
Posts: 34

Original Poster
Rep: Reputation: 15
It worked....var=`date`
echo $var

THanks a millon

Any clue how can I concantenate this value of var to string in my script.
 
Old 02-09-2004, 01:43 PM   #5
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
should be something like
Code:
#!/bin/bash
var=`date`
string1="Right now it's "
string2="$string1$var"
echo $string2
 
  


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
how to send user defined signal in linux feetyouwell Linux - Software 6 12-26-2007 05:40 AM
Linux Script which uses user defined variables fieldyweb Linux - Newbie 3 09-26-2005 07:29 PM
User defined protocols with Guarddog Shafted Linux - Security 4 09-01-2005 01:56 PM
how to define user-defined commands in linux mannoulla Linux - General 1 04-05-2005 10:01 PM
C++: How to use a namespace in a user-defined library? Gethyn Programming 9 08-15-2003 06:29 AM


All times are GMT -5. The time now is 04:23 AM.

Main Menu
Advertisement
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