I have files molecule416_out.pdbqt, where I am using variable i (molecule$i_out.pdbqt) to loop over all files. But it looks like it is reading the variable as i_out instead of just i. Since all those files are results of long simulations so can't rerun them to remove that underscore from out files. Is there any quick fix? Thanks.
Asked
Active
Viewed 62 times
1 Answers
2
Use molecule${i}_out.pdbqt
The ${varname}
syntax delimits the part of the string that is the variable name, so the shell can do what you intend.

Sotto Voce
- 4,131
${i}_out....
– Edgar Magallon Oct 22 '22 at 05:15{}
when you need to separate a variable name from immediately adjacent text that happens to be valid characters for variable names. – cas Oct 22 '22 at 13:09