The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
appending space to variable viv1 Shell Programming and Scripting 5 02-04-2008 07:01 AM
Replace variable with a user defined variable ce124 Shell Programming and Scripting 1 04-15-2007 03:56 PM
Export command giving Variable Name vs the Value set for the Variable ParNone UNIX for Dummies Questions & Answers 2 04-03-2006 12:43 PM
space in variable esham Shell Programming and Scripting 4 11-20-2005 04:39 AM
How to trim space in output variable ? vj_76 Shell Programming and Scripting 5 06-12-2005 04:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-15-2007
jaydeep_sadaria jaydeep_sadaria is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 37
how to merge two variable in one variable with space between them?

Dear all

I had two separate variable. Now i want to make them merge into one new variable with space between them. Kindly suggest me.

var1=dec 15
var2=10

i want var3=dec 15 10


My main aim is as below:

op of date command:
>date
>Sat Dec 15 10:17:35 IST 2007

i want only Dec 15 10: in new variable.

Suggest me possible ways.

Thanks in advance

regards
jaydeep
  #2 (permalink)  
Old 12-15-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
var3="$var1 $var2"

or

var3=$var1\ $var2
  #3 (permalink)  
Old 12-15-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by jaydeep_sadaria View Post
Dear all

I had two separate variable. Now i want to make them merge into one new variable with space between them. Kindly suggest me.

var1=dec 15
var2=10

i want var3=dec 15 10


My main aim is as below:

op of date command:
>date
>Sat Dec 15 10:17:35 IST 2007

i want only Dec 15 10: in new variable.

Suggest me possible ways.

Thanks in advance

regards
jaydeep

Code:
val=$(date "+%b %d %H")

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0