In this example, why does blacklist end up in the file
blacklist and $a end up in
stdout?
Code:
#!/bin/sh
test= 'lsmod' | 'awk' '/snd_/{print $1}' > audiodrivers
while a=read line
do
echo -n "blacklist $a" >> test.txt
done < /root/testscript/audiodrivers
The desired result is to have a file containing the results of lsmod which had the first word on the line beginning with snd_ copied into another file preceded by the word
blacklist
so audiodrivers contains
snd_driver1
snd_driver2
etc
and blacklist will contain
blacklist snd_driver1
blacklist snd_driver2
etc