Question: I have a script that goes through many different checks and I use the `success`, `failure` functions defined in `/etc/init.d/functions` to clearly show the action result on the terminal.

That works great, except in some cases where I print a bit more text, I then get the result box displayed *over my text*:

`/usr/share/app/lib/lib_mylib.so lib[ OK ]o matches as expected`

Where I'd like it to be displayed:

`/usr/share/app/lib/lib_mylib.so lib_mylib.so matches as expected [ OK ]`

Looking around I saw that `/etc/init.d/functions` is using a variable `RES_COL` to position where to print the result field. If `/etc/sysconfig/init` exists then `RES_COL` is taken from there, set by default to 60 chars. 

I've tried `export RES_COL=100` after sourcing `/etc/init.d/functions` to no avail.
Furthermore I'd like the result field to be **right-aligned** with the terminal window and not having to hard-code any value for that. Any idea?

Answer: 
Why not read line by line using while :

```
while read -r line
do
        if ! grep -Fxq " $line " /etc/sysctl.conf
        then
        echo -e "$line" >> ~/testfile
        fi
done </etc/sysctl.conf

```

and Replaced > with >>.
If I understand your question correct your problem is the expansion of the $( cat ) expression which is split at spaces so that the loop iterates over all fields in the data instead of the lines. To fix that you can use this approach...

```
while IFS= read -r i
do
  ...your loop code operating on $i here...

done < /etc/sysctl.conf

```