To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

http://justlinux.com/   Fri, 03-Sep-2010 14:37:19 GMT
         internet.com

Go Back   JustLinux Forums > Community Help: Check the Help Files, then come here to ask! > Programming/Scripts

Programming/Scripts Perl, Python, C/C++, Java, CGI, shell, etc. Share your code!

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-14-2005, 09:56 AM
Architect Architect is offline
Creating the Matrix...
 
Join Date: Jan 2005
Posts: 229
string concatenation in bash

How do you join two strings. I have two strings in 2 differnent vars. How can I join this and assign it to another var in bash?
__________________
The Problem is Choice.
Reply With Quote
  #2  
Old 05-14-2005, 12:29 PM
deathadder's Avatar
deathadder deathadder is offline
Linux User #313008
 
Join Date: Sep 2002
Location: Harlow, UK
Posts: 1,788
sed or awk?

Can't help with any code though

Maybe:
Code:
man awk

-v var=value   assigns value to program variable var.
__________________
If you have to ask why you want to install Linux, then perhaps you shouldn't.
-- Michael D. Watts (Gone but never forgotten)

Linux is not Windows | Posting Guidelines

Code Monkey (YouTube)

Last edited by deathadder; 05-14-2005 at 12:45 PM.
Reply With Quote
  #3  
Old 05-14-2005, 05:31 PM
DrChuck's Avatar
DrChuck DrChuck is offline
but I don't want ANY spam
 
Join Date: Jan 2004
Location: Milwaukee
Posts: 313
Concatenation is easy and intuitive in bash:

$ a=hip
$ b=hop
$ ab=$a$b
$ echo $ab
hiphop

Check out the link in my sig for a great bash reference.

drChuck
__________________
"Well, I've been to one world fair, a picnic, and a rodeo, and that's the stupidest thing I ever heard come over a set of earphones."
Reply With Quote
  #4  
Old 05-16-2005, 08:37 AM
Architect Architect is offline
Creating the Matrix...
 
Join Date: Jan 2005
Posts: 229
Thanks a lot. I did try that (in a different sort of way) I used
$c= $a $b
because I needed a space in between. Now I use
$c= $a$space$b.
__________________
The Problem is Choice.
Reply With Quote
  #5  
Old 05-16-2005, 12:10 PM
hlrguy's Avatar
hlrguy hlrguy is offline
Mandriva 1 on a T3640
 
Join Date: Sep 2002
Location: San Antonio, TX
Posts: 2,599
$a=cow
$b=tipping
$complete=$a" are not for "$b
echo $complete
cows are not for tipping

hlrguy
__________________
Were you a Windows expert the VERY first time you looked at a computer with Windows, or did it take a little time.....
My Linux Blog
Linux Native Replacements for Windows Programs
Mandriva One on a "Vista Home Barely" T3640 E-Machine runs great.
Reply With Quote
Reply

Bookmarks

Thread Tools
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
Forum Jump


All times are GMT -4. The time now is 10:37 AM.

Help File Library
Webservers
Fonts
Soundcards
Hardware
Filesystems
More



internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
Free Newsletter
Server Daily


More Free Newsletters




internet.commerce
Be a Commerce Partner












Linux is a trademark of Linus Torvalds.

Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.7.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.