I need to execute the following command :
melt color:"#eeeeee" -filter dynamictext:"this text"
"this text"
is a string from a title.txt
file.
I read the file by using this method:
while IFS='' read -r line || [[ -n "$line" ]]; do
echo $line
done < "title.txt"
The problem is how to make -filter dynamictext:"this text"
in bash loop as string and then finally execute:
melt color:"#eeeeee" $string
I used this code but with no luck so far:
while IFS='' read -r line || [[ -n "$line" ]]; do
string="$string -filter dynamictext:\"$line\""
done < "title.txt"
melt error : Failed to load "text"
title.txt
contains:
this text
second text
anothe text
Use an array; this is the exact use case they were introduced to handle.
while IFS= read -r line; do
options+=(-filter dynamictext:"$line")
done < title.txt
melt color:#eeeeee "${options[@]}"
Fix title.txt
so that it correctly ends with a newline.