Sorry if the question is very straight forward but am a newbie to shell scripting.
I am trying to write something like this :
for i in {1..20}
do
curl "something $i ........ -d 'something "$i" something' "
done
The problem is that the second $i inside the single quotes part ” is not being replaced. What should be done to get it working ?
As said above, parameters are not expanded inside single quotes, you have to use double quotes. The only point is that since it occurs in a already double-quoted string, you have to escape them with a backslash (
\), like this:Note that there are three
\before the innermost", as this will be expanded twice (once when evaluating the argument ofevaland once when evaluating the argument ofecho)