Matthew_S wrote:
> For arguments sake I’ve put ‘I want this whole line on one line’ into the
> config file and the script looks like this;
> 
> for i in `cat config.txt`

The result of this will be split on words.  That is not what you want.

> It’s been suggested that I try read and so I have this;

Yes.  Read would be quite a better way to do it.

> File=./config.txt
> 
> {
> read line
>         echo $i
>         echo >> $RESULTS
>         echo $i >> $RESULTS
>         $i
>         [ $? == 0 ] && echo "PASSED" >> $RESULTS || echo "FAILED" >>
> $RESULTS
> } < $File

That above makes no sense to me.

Try something more like this:

  while read line ; do
    echo "$line"
  done < config.txt

> But need to get the numbered input from by using cat -n on the config file,

Can you simply keep track of the line numbers yourself as you go along?

  lineno=0
  while read line ; do
    lineno=$(($lineno + 1))
    echo "$lineno: $line"
  done < config.txt

Bob


Reply via email to