Concatenating two variables/strings with a shell script?

From: Heiden, John (JHeiden@UTNet.UToledo.Edu)
Date: Tue Mar 11 2003 - 16:16:30 EST


I have been hitting my head against the wall for the last 24 hours trying to
get this to work.
The gist of it is that I have a file I am reading from, each line has one word
on it. I need to
be able to read, line by line, from the file, and then put the list of words
into one variable
(with a single space between) and then print to the screen.

Here's what I have, which I can't seem to make work...

#!/bin/sh
[...]
  while read port
  do
echo $port
echo $portlist
    portlist="$portlist $port"
echo $portlist
  done < $ports
  echo "$dst, $count times, on $portcount ports ($portlist)"

And here's what I get in the way of output each time this block of
code is run...

1214

1214
server-1, 9 times, on 1 ports ( )

Can anyone tell me what I am missing here and how I can make
this work? I wrote like 300 lines of code for this project, and this
is the only part I can't seem to make work right.

I very much appreciate this list and all of the nice ideas I have
read here. Thanks much!

John Heiden
Network Engineer
The University of Toledo
Toledo, OH 43606
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:58 EDT